{"id":16125698,"url":"https://github.com/dy/pretty-number","last_synced_at":"2025-07-24T22:37:45.323Z","repository":{"id":57330171,"uuid":"72482329","full_name":"dy/pretty-number","owner":"dy","description":"Format number to more humane form than toFixed","archived":false,"fork":false,"pushed_at":"2016-11-01T04:51:07.000Z","size":11,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T18:59:39.886Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-31T22:11:54.000Z","updated_at":"2024-01-09T10:25:52.000Z","dependencies_parsed_at":"2022-09-09T08:50:15.581Z","dependency_job_id":null,"html_url":"https://github.com/dy/pretty-number","commit_stats":null,"previous_names":["dfcreative/pretty-number"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fpretty-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fpretty-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fpretty-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fpretty-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dy","download_url":"https://codeload.github.com/dy/pretty-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485291,"owners_count":20946398,"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-09T21:30:45.976Z","updated_at":"2025-04-06T13:13:03.500Z","avatar_url":"https://github.com/dy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#pretty-number [![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)\n\nFormat number so it gets more humane format.\n\n\n## Usage\n\n[![npm install pretty-number](https://nodei.co/npm/pretty-number.png?mini=true)](https://npmjs.org/package/pretty-number/)\n\n```js\nconst pretty = require('pretty-number');\n\npretty(10e+20) //10²¹\npretty(12e+20) //1.2 × 10²¹\npretty(1) //1\npretty(0) //0\npretty(-1) //−1\npretty(1.555e+20) //1.555 × 10²⁰\npretty(1.555e-15) //1.555 × 10⁻¹⁵\npretty(Infinity) //∞\npretty(-Infinity) //−∞\npretty(7.2973525664e-3, 3) //7.297 352 5664 × 10⁻³\npretty(72973525.664) //72 973 525.664\npretty(.123) //0.123\npretty(-.123) //−0.123\npretty(1.5) //1.5\npretty(-1.5) //−1.5\npretty(1e100) //10¹⁰⁰\npretty(-1e100) //−10¹⁰⁰\npretty(1e-100) //10⁻¹⁰⁰\npretty(-1e-100) //−10⁻¹⁰⁰\n\n//indicate wishful precision\npretty(-0.000000005) //0\npretty(-0.000000005, 12) //−0.000 000 005\n```\n\nFormatting can be modified via constants:\n\n```js\npretty.multSign = '×';\npretty.minusSign = '−';\npretty.spaceSign = ' ';\npretty.fractSign = '.';\npretty.precision = 9;\n```\n\nNote also that to make result look good custom font may be needed.\n\n## Related\n\n* [human-format](https://github.com/JsCommunity/human-format) — handle SI prefixes, supposedly works well with pretty-number.\n* [mumath](https://github.com/dfcreative/mumath) — set of practical math utils.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fpretty-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdy%2Fpretty-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fpretty-number/lists"}