{"id":41079,"library":"fast-number-formatter","title":"fast-number-formatter","description":"A React-focused number formatting library (v2.0.4) that enforces reuse of formatter instances to improve performance, avoiding creation of new Intl.NumberFormat objects per call. It wraps native Intl API with a caching layer and provides TypeScript types. Currently in early development with potential breaking changes. Differentiator: fixed API that forces best practices compared to ad-hoc formatting. Released via semantic-release, maintained by Agoda.","status":"active","version":"2.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/agoda-com/react-handyman","tags":["javascript","react","fast number formatting","number formatting","number format","formatting","format","typescript"],"install":[{"cmd":"npm install fast-number-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add fast-number-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add fast-number-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is not available; use named import.","wrong":"import formatNumber from 'fast-number-formatter'","symbol":"formatNumber","correct":"import { formatNumber } from 'fast-number-formatter'"},{"note":"CommonJS require works but named import is preferred for tree-shaking.","wrong":"const getNumberFormatter = require('fast-number-formatter').getNumberFormatter","symbol":"getNumberFormatter","correct":"import { getNumberFormatter } from 'fast-number-formatter'"},{"note":"Sets global locale; affects all subsequent format calls.","wrong":"","symbol":"setCurrentCulture","correct":"import { setCurrentCulture } from 'fast-number-formatter'"},{"note":"Accepts NumberFormatOptions object for advanced Intl configuration.","wrong":"","symbol":"getCustomNumberFormatter","correct":"import { getCustomNumberFormatter } from 'fast-number-formatter'"},{"note":"TypeScript type, not a runtime value; use 'import type' for isolated type imports.","wrong":"import { NumberFormatOptions } from 'fast-number-formatter'","symbol":"NumberFormatOptions","correct":"import type { NumberFormatOptions } from 'fast-number-formatter'"}],"quickstart":{"code":"import { formatNumber, getNumberFormatter, setCurrentCulture } from 'fast-number-formatter'\n\n// Basic formatting with default locale (en-US)\nconst result1 = formatNumber(12345.6789) // '12,345.68'\nconsole.log(result1)\n\n// Specify decimal places\nconst result2 = formatNumber(12345.6789, 1) // '12,345.7'\nconsole.log(result2)\n\n// Change locale globally\nsetCurrentCulture('de-DE')\nconst result3 = formatNumber(12345.6789, 2) // '12.345,68'\nconsole.log(result3)\n\n// Use a cached formatter for performance\nconst formatter = getNumberFormatter(3, 'fr-FR')\nconsole.log(formatter.format(12345.6789)) // '12 345,679'\nconsole.log(formatter.format(9876.54321)) // '9 876,543'\n\n// Reset to default\nsetCurrentCulture('en-US')","lang":"typescript","description":"Shows basic formatting, locale switching, and cached formatter reuse for performance."},"warnings":[{"fix":"Pin exact version and test thoroughly when upgrading.","message":"Breaking changes may occur in early versions; API not stable.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Use locale-specific formatter with getNumberFormatter or getCustomNumberFormatter instead of global state.","message":"setCurrentCulture affects all subsequent calls globally; may cause unexpected behavior in concurrent environments.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'import type { NumberFormatOptions }' or use inline type if not needed.","message":"Importing TypeScript type NumberFormatOptions at runtime will cause error.","severity":"gotcha","affected_versions":"all"},{"fix":"","message":"No deprecation warnings known yet.","severity":"deprecated","affected_versions":"none"}],"env_vars":null,"search_vec":"'ad':61 'ad-hoc':60 'agoda':71 'api':34,53 'avoid':22 'best':56 'break':49 'cach':37 'call':29 'chang':50 'compar':58 'creation':23 'current':43 'develop':46 'differenti':51 'earli':45 'enforc':14 'fast':2,74 'fast-number-formatt':1 'fix':52 'focus':8 'forc':55 'format':10,63,76,78,80,81,82 'formatt':4,17 'hoc':62 'improv':20 'instanc':18 'intl':33 'intl.numberformat':26 'javascript':72 'layer':38 'librari':11 'maintain':69 'nativ':32 'new':25 'number':3,9,75,77,79 'object':27 'per':28 'perform':21 'potenti':48 'practic':57 'provid':40 'react':7,73 'react-focus':6 'releas':64,68 'reus':15 'semant':67 'semantic-releas':66 'type':42 'typescript':41,83 'v2.0.4':12 'via':65 'wrap':31","created_at":"2026-06-04T18:50:40.595280+00:00","updated_at":"2026-06-04T18:50:40.595280+00:00","problems":[{"fix":"Change to: import { formatNumber } from 'fast-number-formatter'","cause":"Default import used instead of named import.","error":"TypeError: fast_number_formatter_1.formatNumber is not a function"},{"fix":"Use 'import type { NumberFormatOptions } from 'fast-number-formatter''","cause":"Attempting to import a type as a value.","error":"Module '\"fast-number-formatter\"' has no exported member 'NumberFormatOptions'."},{"fix":"Verify locale string (e.g., 'en-US', 'de-DE') and ensure Intl support.","cause":"setCurrentCulture called with an invalid or unsupported locale.","error":"Error: Invalid locale. Please set a valid locale string."},{"fix":"Ensure decimalPlaces is a number and options object is correct.","cause":"getNumberFormatter or getCustomNumberFormatter returned undefined due to invalid args.","error":"TypeError: Cannot read property 'format' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/agoda-com/react-handyman#readme","github":"https://github.com/agoda-com/react-handyman","docs":null,"changelog":null,"pypi":null,"npm":"fast-number-formatter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}