XGitHub

Sanitization

Numora sanitizes every value through a sequential pipeline before formatting is applied. For the full architecture and pipeline diagram, see How It Works. The sections below cover each configurable sanitization feature.

Non-numeric Character Filtering

Numora automatically removes invalid characters while preserving:

  • Digits (0-9)
  • Decimal separator (configured via decimalSeparator)
  • Negative sign (-) if enableNegative is true
typescript
import { NumoraInput } from 'numora'

const numoraInput = new NumoraInput(container, {
  decimalMaxLength: 2,
  // Invalid characters are automatically removed
  // Try typing letters or special characters - only numbers will be kept
})

removeThousandSeparators

Numora exports a standalone removeThousandSeparators utility for stripping thousand separators from a formatted string. Useful when you need to extract a raw numeric value from a display string.

(You can also access the raw value of the input by e.target.rawValue when rawValueMode is true)

typescript
import { removeThousandSeparators } from 'numora'

removeThousandSeparators('1,234,567.89', ',') // → '1234567.89'
removeThousandSeparators('1.234.567,89', '.') // → '1234567,89'
removeThousandSeparators('1 234 567', ' ')    // → '1234567'