{"id":16007692,"url":"https://github.com/uzitech/number-string","last_synced_at":"2025-03-18T02:32:18.137Z","repository":{"id":6893850,"uuid":"55640888","full_name":"UziTech/number-string","owner":"UziTech","description":"Node module to format number to string","archived":false,"fork":false,"pushed_at":"2024-10-29T18:18:19.000Z","size":4199,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T20:25:09.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/number-string","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UziTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["UziTech"]}},"created_at":"2016-04-06T21:12:37.000Z","updated_at":"2024-10-29T18:18:05.000Z","dependencies_parsed_at":"2023-11-30T03:26:03.338Z","dependency_job_id":"e7d9d579-e9cc-4c29-b6fa-45c6ddb67d5f","html_url":"https://github.com/UziTech/number-string","commit_stats":{"total_commits":996,"total_committers":9,"mean_commits":"110.66666666666667","dds":0.5421686746987953,"last_synced_commit":"8bdf3fed6b974a94cb67f840e6959e2b9e766614"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UziTech%2Fnumber-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UziTech%2Fnumber-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UziTech%2Fnumber-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UziTech%2Fnumber-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UziTech","download_url":"https://codeload.github.com/UziTech/number-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243894540,"owners_count":20365048,"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-10-08T12:04:42.137Z","updated_at":"2025-03-18T02:32:17.778Z","avatar_url":"https://github.com/UziTech.png","language":"TypeScript","funding_links":["https://github.com/sponsors/UziTech"],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/UziTech/number-string/workflows/CI/badge.svg)](https://github.com/UziTech/number-string/actions)\n[![npm downloads](https://img.shields.io/npm/dm/number-string.svg)](https://www.npmjs.com/package/number-string)\n[![npm License](https://img.shields.io/npm/l/number-string.svg)](https://spdx.org/licenses/MIT)\n[![GitHub issues](https://img.shields.io/github/issues/UziTech/number-string.svg)](https://github.com/UziTech/number-string/issues)\n[![GitHub stars](https://img.shields.io/github/stars/UziTech/number-string.svg)](https://github.com/UziTech/number-string/stargazers)\n\n Usage\n-------\n\n### .toNumber\n\nConvert a string to number disregarding other characters\n\n```js\nimport { toNumber } from \"number-string\";\n\ntoNumber(\"$1.57\"); // 1.57\n```\n\nParameters:\n\n```js\ntoNumber(stringOrNumber, {\n  decimalMark = \".\",\n});\n```\n\n### .toNumberString\n\nConvert a string to string of the numbers disregarding other characters\n\n```js\nimport { toNumberString } from \"number-string\";\n\ntoNumberString(\"$1.57\"); // \"1.57\"\n```\n\nParameters:\n\n```js\ntoNumberString(stringOrNumber, {\n  decimalMark = \".\",\n});\n```\n\n### .toClean\n\nLike toFixed but removes trailing 0's\n\n```js\nimport { toClean } from \"number-string\";\n\ntoClean(1.5009, {maxPrecision: 2}); // \"1.5\"\n```\n\nParameters:\n\n```js\ntoClean(stringOrNumber, {\n\tdecimalMark = \".\",\n\tthousandSeparator = \",\",\n\tmaxPrecision = 10, // maximum precision possible is 10 to prevent floating point errors\n\tminPrecision = 0,\n});\n```\n\n### .toMoney\n\nConverts number to currency\n\n```js\nimport { toMoney } from \"number-string\";\n\ntoMoney(-1234.5); // \"($1,234.50)\"\n```\n\nParameters:\n\n```js\ntoMoney(stringOrNumber, {\n\tdecimalMark = \".\",\n\tthousandSeparator = \",\",\n\tmaxPrecision = 2, // maximum precision possible is 10 to prevent floating point errors\n\tminPrecision = 2,\n\tsymbol = \"$\",\n\tsymbolBehind = false,\n\tuseParens = true,\n});\n```\n\n### .toClosest\n\nRounds to the closest interval\n\n```js\nimport { toClosest } from \"number-string\";\n\ntoClosest(12.6, 7.1); // 14.2\n```\n\nParameters:\n\n```js\ntoClosest(stringOrNumber, roundToNearestNumber);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuzitech%2Fnumber-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuzitech%2Fnumber-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuzitech%2Fnumber-string/lists"}