Value Type Convertibility Checker
Check if a value can be safely converted to String, Integer, Number, or Boolean. Analyze type convertibility for any JavaScript value instantly.
About
Implicit type coercion in JavaScript is the leading cause of silent data corruption in production pipelines. A value like v = "123" passes most truthy checks but fails strict integer comparisons. This tool applies five canonical type predicates - isString, isInteger, isNumber, isBoolean, and isNotEmpty - against any raw input to produce a convertibility matrix. Results follow the same logic as the lib-control-type-for-convert specification: whitespace-only strings return TRUE for isString but FALSE for isNotEmpty. Comma-decimal numbers like "123,43" are not recognized as numeric. This tool does not use eval(). All parsing is done through safe regex and native Number/JSON.parse calls. Limitation: function detection relies on string pattern matching since actual function objects cannot be transmitted via a text input.
Formulas
Each predicate function applies a specific detection algorithm to the input value v. The tool first determines the interpretation of the raw input - whether it represents a JS literal or a quoted string - then runs all five checks.
Where v is the input value, Z is the set of integers, Number() is the native JS coercion function, and isFinite() excludes Infinity and βInfinity. The comma-decimal format ("123,43") is intentionally rejected by isNumber because Number("123,43") returns NaN in JavaScript. For empty arrays [], isNotEmpty returns FALSE because the array has zero elements despite being a valid object.
Reference Data
| Example Value | isString() | isInteger() | isNumber() | isBoolean() | isNotEmpty() |
|---|---|---|---|---|---|
" " | TRUE | ||||
'' | TRUE | ||||
"test" | TRUE | TRUE | |||
"123" | TRUE | TRUE | TRUE | TRUE | |
| 123 | TRUE | TRUE | TRUE | ||
"123.43" | TRUE | TRUE | TRUE | ||
| 123.43 | TRUE | TRUE | |||
"123,43" | TRUE | TRUE | |||
"true" | TRUE | TRUE | TRUE | ||
| TRUE (literal) | TRUE | TRUE | |||
"false" | TRUE | TRUE | TRUE | ||
| FALSE (literal) | TRUE | TRUE | |||
| NULL | |||||
undefined | |||||
| NaN | |||||
"{}" | TRUE | TRUE | |||
{} (object) | TRUE | ||||
"[]" | TRUE | TRUE | |||
[] (array) | |||||
"function(){}" | TRUE | TRUE | |||
function(){} | TRUE | ||||
"0" | TRUE | TRUE | TRUE | TRUE | |
| 0 | TRUE | TRUE | TRUE | ||
"-5.7" | TRUE | TRUE | TRUE | ||
| β5.7 | TRUE | TRUE | |||
"Infinity" | TRUE | TRUE | |||
"1e5" | TRUE | TRUE | TRUE | TRUE | |
"0xFF" | TRUE | TRUE | TRUE | TRUE | |
"3.14.15" | TRUE | TRUE |