{"id":15021122,"url":"https://github.com/exodusmovement/format-num","last_synced_at":"2025-10-27T13:30:59.858Z","repository":{"id":57240394,"uuid":"54129178","full_name":"ExodusMovement/format-num","owner":"ExodusMovement","description":"JavaScript component to format numbers to strings.","archived":true,"fork":false,"pushed_at":"2024-08-27T12:18:48.000Z","size":20,"stargazers_count":15,"open_issues_count":1,"forks_count":7,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-02-10T05:11:35.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ExodusMovement.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-17T15:25:48.000Z","updated_at":"2024-12-05T15:17:29.000Z","dependencies_parsed_at":"2024-06-18T15:37:03.790Z","dependency_job_id":"dbbad4ba-3a07-477b-98ed-dca87744bb96","html_url":"https://github.com/ExodusMovement/format-num","commit_stats":{"total_commits":28,"total_committers":7,"mean_commits":4.0,"dds":0.6428571428571428,"last_synced_commit":"2f127d6a1735e42fd9a8071ee1f37ed01d7e8fcd"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExodusMovement%2Fformat-num","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExodusMovement%2Fformat-num/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExodusMovement%2Fformat-num/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExodusMovement%2Fformat-num/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExodusMovement","download_url":"https://codeload.github.com/ExodusMovement/format-num/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238497714,"owners_count":19482302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:56:09.737Z","updated_at":"2025-10-27T13:30:54.531Z","avatar_url":"https://github.com/ExodusMovement.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"format-num\n==========\n\n[![NPM Package](https://img.shields.io/npm/v/format-num.svg?style=flat-square)](https://www.npmjs.org/package/format-num)\n[![Build Status](https://img.shields.io/travis/ExodusMovement/format-num.svg?branch=master\u0026style=flat-square)](https://travis-ci.org/ExodusMovement/format-num)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\n`format-num` is a JavaScript component to format numbers to strings. Used in [Exodus Ethereum Wallet](http://www.exodus.io/).\n\n\nInstall\n-------\n\n    npm install --save format-num\n\n\nNotes\n-----\n\n- Must have a JavaScript environment with `Object.assign` and `Intl.NumberFormat`.\nIn Node.js, this is at least v4. You can install in older environments, you'll just\nneed to polyfill.\n\n\nUsage\n-----\n\n### formatNum\n\n**Signature:** `formatNum(value, [options])`\n\n**Parameters:**\n\n- `value`: Value to convert. Will pass through [parse-num](https://github.com/ExodusMovement/parse-num) first.\nWill coerce anything to a number.\n- `options`: *optional* `object` parameter to specify [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat).\nAppending `Digits` is not necessary. You can also shorten `maximum` to `max` and `minimum` to `min`. Adds one more option `nanZero`, which when the number is\n`NaN`, if it should be coerced to `0` - defaults to `true` i.e. `NaN =\u003e '0'`.\n\n\n**Returns:**\n\nThe `string` representation of the number.\n\n**Example:**\n\n```js\nconst formatNum = require('format-num')\n\nconsole.log(formatNum(10000000.15)) // =\u003e 10,000,000.15\nconsole.log(formatNum('10000000.15')) // =\u003e 10,000,000.15\n\nconsole.log(formatNum(0.0000000000044535, { maxSignificant: 2 })) // =\u003e 0.0000000000045\nconsole.log(formatNum(0, { minFraction: 2, maxFraction: 2 }))  // =\u003e 0.00\n\nconsole.log(formatNum(null)) // =\u003e 0\nconsole.log(formatNum(null, { nanZero: false })) // =\u003e NaN\n```\n\n\nRelated\n-------\n\n- [parse-num](https://github.com/ExodusMovement/parse-num): Parse anything into a number. A dependency\nof this library.\n- [number-unit](https://github.com/ExodusMovement/number-unit): Numbers with units. Easily convert numbers to from different units.\n\n\nLicense\n-------\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexodusmovement%2Fformat-num","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexodusmovement%2Fformat-num","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexodusmovement%2Fformat-num/lists"}