Skip to content

parseNumber

parseNumber<T>(spec, options?): MapSpec<T>

Defined in: extract/spec.ts:877

Parse a string value into a number.

Handles common number formats: currency symbols ($, , £, ¥, ), thousands separators, accounting negatives (1,234.56), percentages, and magnitude suffixes (K/M/B/T).

Produces schemaHint: { type: 'number' } for schema derivation.

T extends Spec

T

NumberParseOptions

MapSpec<T>

// Plain number
parseNumber($.get('amount').string())
// European format (comma decimal)
parseNumber($.get('amount').string(), { decimal: ',' })
// Disable percent handling
parseNumber($.get('rate').string(), { percent: false })