{"id":16203973,"url":"https://github.com/mottie/javascript-number-formatter","last_synced_at":"2025-10-10T11:16:53.009Z","repository":{"id":16609054,"uuid":"19363825","full_name":"Mottie/javascript-number-formatter","owner":"Mottie","description":"Lightweight \u0026 Fast JavaScript Number Formatter","archived":false,"fork":false,"pushed_at":"2019-08-16T23:36:05.000Z","size":82,"stargazers_count":143,"open_issues_count":11,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-25T12:27:09.076Z","etag":null,"topics":["currency","formatter","internationalization","javascript","number"],"latest_commit_sha":null,"homepage":"http://mottie.github.io/javascript-number-formatter/","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/Mottie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-02T02:18:06.000Z","updated_at":"2025-09-21T14:12:02.000Z","dependencies_parsed_at":"2022-08-27T19:40:47.512Z","dependency_job_id":null,"html_url":"https://github.com/Mottie/javascript-number-formatter","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/Mottie/javascript-number-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mottie%2Fjavascript-number-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mottie%2Fjavascript-number-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mottie%2Fjavascript-number-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mottie%2Fjavascript-number-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mottie","download_url":"https://codeload.github.com/Mottie/javascript-number-formatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mottie%2Fjavascript-number-formatter/sbom","scorecard":{"id":96335,"data":{"date":"2025-08-11","repo":{"name":"github.com/Mottie/javascript-number-formatter","commit":"c252291e0c95875251faaab62f9276f626ad2d3d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T09:07:52.901Z","repository_id":16609054,"created_at":"2025-08-15T09:07:52.901Z","updated_at":"2025-08-15T09:07:52.901Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003726,"owners_count":26083610,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["currency","formatter","internationalization","javascript","number"],"created_at":"2024-10-10T09:55:51.416Z","updated_at":"2025-10-10T11:16:52.989Z","avatar_url":"https://github.com/Mottie.png","language":"JavaScript","readme":"# Javascript Number Formatter\n\nLightweight \u0026 Fast JavaScript Number Formatter\n\n[![Build Status][build-image]][build-url] [![NPM Version][npm-image]][npm-url] [![devDependency Status][david-dev-image]][david-dev-url] [![MIT][license-image]][license-url]\n\n## Introduction\n\nThis standalone number formatter\u003csup\u003e\u0026dagger;\u003c/sup\u003e is intended to be short and fast. As they are the main factors for a high performance JavaScript app. Development release is around 150 lines including license info, blank lines and comments. And production release is less than 2,000 bytes.\n\n```js\nformat( \"#,##0.####\", 1234567.890 );  // output: \"1,234,567.89\"\nformat( \"$ #,###.00\", -1234567.890 ); // output: \"$ -1,234,567.89\"\n\n// Added in v2.0.0\nformat( \"$ #,###.00\", -1234567.890, {enforceMaskSign: true});  // output: \"$ 1,234,567.89\"\nformat( \"$ -#,###.00\", -1234567.890, {enforceMaskSign: true}); // output: \"$ -1,234,567.89\"\nformat( \"$ +#,###.00\", -1234567.890, {enforceMaskSign: true}); // output: \"$ -1,234,567.89\"\nformat( \"$ +#,###.00\", 1234567.890, {enforceMaskSign: true});  // output: \"$ +1,234,567.89\"\n```\n\n\u0026dagger; Initial development release of this code was written by KPL and hosted at [Google Code](https://code.google.com/p/javascript-number-formatter/).\n\n## Features\n\n* Short, fast, flexible yet standalone.\n* Accept standard number formatting like `#,##0.00` or with negation `-000.####`.\n* Accept any country format like `# ##0,00`, `#,###.##`, `#'###.##` or any type of non-numbering symbol.\n* Accept any numbers of digit grouping. `#,##,#0.000` or `#,###0.##` are all valid.\n* Accept any redundant/fool-proof formatting. `##,###,##.#` or `0#,#00#.###0#` are all OK.\n* Auto number rounding.\n* Simple interface, just supply mask \u0026 value like this: `format( \"0.0000\", 3.141592)`.\n* Include a prefix \u0026amp; suffix with the mask.\n\n## Limitations\n\n* No scientific/engineering formatting.\n* Not for date or phone formation.\n* No color control.\n* \u003cdel\u003eNo prefix or suffix is allowed except leading negation symbol. So `$#,##0.00` or `#,###.##USD` will not yield expected outcome. Use `'$'+format('#,##0.00', 123.45)` or `format('#,##0.00', 456.789) + 'USD'`\u003c/del\u003e\n* The prefix or suffix *can not* include any numbers (`0-9`), dashes (`-`), or plus signs (`+`).\n\n## Format Symbols\n\n| Description   | Symbol | Summary |\n|---------------|--------|---------|\n| Mask symbols  | #0123456789+- | Mask symbols used for formatting the value. |\n| Placeholders  | #123456789    | Un-forced digit*; this optional digit will only show if it is required as a placeholder. |\n| Zero          | 0             | Forced digit; the digit will be shown whether or not the digit is relevant to the value. |\n| Signs         | +-            | Indicates a positive or negative value; visible depending on the value sign and the `enforceMaskSign` setting. |\n| Leftmost      |               | _Any_ non-mask symbol\u0026dagger; inside the mask will be set to represent a thousands separator. |\n| Rightmost     |               | _Any_ non-mask symbol\u0026dagger; inside the mask\u0026Dagger; will be set to represent the decimal separator. |\n| Prefix/Suffix |               | _Any_ non-mask symbol\u0026dagger; outside the mask. |\n\n\\* Non-zero mask digits (`1` through `9`) behave the same as the `#`.\u003cbr\u003e\n\u0026dagger; Anything not a digit, and not a `+`, `-` or `#`.\u003cbr\u003e\n\u0026Dagger; In the case where there is a trailing decimal or comma, it will be included in the mask, e.g. `#.` or `0,`.\n\n## Note\n\nWhen only one symbol is supplied, the library will always treat that symbol as a decimal. For example, `format( '#,###', 1234567.890)` will output `1234567,890`.\n\nTo force a single symbol to be used as a separator, add a trailing symbol. In this example, a period is added to the end of the mask - `format( '#,###.', 1234567.890)` - resulting in it being used as a decimal and forcing the first symbol to be the separator and return this output: `1,234,567`.\n\n## Installation\n\n### npm package\n\n    npm install --save number-format.js\n\n## Demos\n\nA demo/sample page with few examples is provided ([demo](http://mottie.github.io/javascript-number-formatter/)).\n\nAnd a jsFiddle was created to aid in testing: https://jsfiddle.net/Mottie/t2etyodx/\n\n[build-url]: https://travis-ci.org/Mottie/javascript-number-formatter\n[build-image]: https://travis-ci.org/Mottie/javascript-number-formatter.png?branch=master\n[npm-url]: https://www.npmjs.com/package/number-format.js\n[npm-image]: https://img.shields.io/npm/v/number-format.js.svg\n[david-dev-url]: https://david-dm.org/Mottie/javascript-number-formatter?type=dev\n[david-dev-image]: https://david-dm.org/Mottie/javascript-number-formatter/dev-status.svg\n[license-url]: https://github.com/Mottie/javascript-number-formatter/blob/master/LICENSE\n[license-image]: https://img.shields.io/badge/license-MIT-blue.svg\n\n## Recent Changes\n\nView the [complete change log here](https://github.com/Mottie/javascript-number-formatter/wiki).\n\n### v2.0.7 (2018-11-13)\n\n* Update typescript binding. See [issue #20](https://github.com/Mottie/javascript-number-formatter/issues/20).\n* Fix improper placeholder behavior. Updated Readme with format symbols table. Closes [issue #19](https://github.com/Mottie/javascript-number-formatter/issues/19).\n* Add more tests.\n* Meta:\n  * Update dependencies.\n  * Improve code readability.\n  * Include version in min.js.\n\n### v2.0.6 (2018-11-06)\n\n* Trim trailing zeros in mask. Fixes [issue #18](https://github.com/Mottie/javascript-number-formatter/issues/18).\n\n### v2.0.0 \u0026ndash; 2.0.5 (2018-10-26)\n\n* Add `ignoreSign` option (modified to `enforeceMaskSign`!).\n* Switch to XO, AVA \u0026 rollup.\n* Meta: Update dot files \u0026 remove bower support.\n* Code cleanup \u0026 convert to ES2015.\n  * Rename `ignoreSign` to `enforceMaskSign` (default `false`).\n  * Reduce code complexity.\n  * Export as node module.\n  * Update TS with options.\n  * Switch demo to use lib file \u0026 highlight valid results.\n* Switch from Grunt to rollup.\n* Switch from IIFE to UMD output.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmottie%2Fjavascript-number-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmottie%2Fjavascript-number-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmottie%2Fjavascript-number-formatter/lists"}