ParseFieldValue
cartographer / parseFieldValue
Function: parseFieldValue()
Section titled “Function: parseFieldValue()”parseFieldValue(
value,fieldType):string|number|boolean|string[] |Date|null
Defined in: types/types.ts:129
Parse field value based on its type definition. Coerces values to the correct type (number, boolean, date, array, etc.).
Parameters
Section titled “Parameters”The raw value to parse
string | number | boolean | string[] | Date | null | undefined
fieldType
Section titled “fieldType”string
The target field type (determines coercion logic)
Returns
Section titled “Returns”string | number | boolean | string[] | Date | null
- Parsed value of the correct type, or null if value is null/undefined
Example
Section titled “Example”const num = parseFieldValue('5000', 'number'); // Returns: 5000const bool = parseFieldValue('true', 'boolean'); // Returns: trueconst date = parseFieldValue('2026-01-06', 'date'); // Returns: Date objectconst arr = parseFieldValue('item1', 'array'); // Returns: ['item1']