{"id":24341302,"url":"https://github.com/gillkyle/zuji","last_synced_at":"2025-04-14T21:08:30.427Z","repository":{"id":272234043,"uuid":"914189370","full_name":"gillkyle/zuji","owner":"gillkyle","description":"TypeScript first, human-readable numeric formatting","archived":false,"fork":false,"pushed_at":"2025-01-22T05:01:40.000Z","size":408,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T06:18:22.424Z","etag":null,"topics":["format","formatter","formatting","javascript","number","number-formatter","numeral","types","typescript"],"latest_commit_sha":null,"homepage":"https://zuji-ts.vercel.app/","language":"TypeScript","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/gillkyle.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-09T05:42:14.000Z","updated_at":"2025-01-22T05:01:44.000Z","dependencies_parsed_at":"2025-01-13T06:28:34.418Z","dependency_job_id":null,"html_url":"https://github.com/gillkyle/zuji","commit_stats":null,"previous_names":["gillkyle/zuji"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillkyle%2Fzuji","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillkyle%2Fzuji/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillkyle%2Fzuji/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gillkyle%2Fzuji/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gillkyle","download_url":"https://codeload.github.com/gillkyle/zuji/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243104843,"owners_count":20237045,"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":["format","formatter","formatting","javascript","number","number-formatter","numeral","types","typescript"],"created_at":"2025-01-18T07:14:38.361Z","updated_at":"2025-03-11T20:22:10.932Z","avatar_url":"https://github.com/gillkyle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e千 zuji\u003c/h1\u003e\n  \u003cbr/\u003e\n  \u003cdiv\u003e\u003cstrong\u003eTypeScript first, human-readable numeric formatting\u003c/strong\u003e\u003c/div\u003e\n  \u003cspan\u003e1540 → 1.5k\u003c/span\u003e\n  \u003ch1\u003e\u003c/h1\u003e\n\u003c/div\u003e\n\nzuji is a developer friendly API for formatting numbers. It is:\n\n- **straightforward to pick up** - the entire API surface is a single function + a few exported types if you need them\n- **standards based** - extends the `Intl.NumberFormat` API, making it consistent with JavaScript runtimes\n- **comprehensive** - covers virtually every option you need to format numbers, supporting every ISO standard locale\n- **tiny** - [~900 bytes](https://bundlephobia.com/package/zuji@1.0.8) with zero dependencies and single purpose\n- **flexible** - when you need to configure it further\n\n## Installation\n\n```bash\nnpm install zuji\n# or\npnpm add zuji\n# or\nyarn add zuji\n# or\nbun add zuji\n```\n\n## Usage\n\n```js\nimport { zuji } from \"zuji\";\n\n// use shortcuts\n// -\u003e currency\nzuji(1234.56, \"compact-currency-usd\"); // \"$1.23K\"\n\n// -\u003e integer\nzuji(1234, \"standard-integer\"); // \"1,234\"\n\n// -\u003e percentage\nzuji(0.1234, \"compact-percent\"); // \"12%\"\n\n// or fallback to an even narrower typed Intl.NumberFormatOptions\n// -\u003e currency without trailing zeros, in accounting notation\nzuji(-1050, {\n  style: \"currency\",\n  currency: \"USD\",\n  currencySign: \"accounting\",\n  trailingZeroDisplay: \"stripIfInteger\",\n}); // \"($1,050)\"\n```\n\n## Why zuji?\n\nNumber formatting is simple on the surface but becomes increasingly complex when you introduce:\n\n- Different grouping separators (1,000 in US vs 1.000 in Spain)\n- Currencies ($ vs ¥)\n- Notations (1,000,000 vs 1M vs 1e6)\n- Rounding (0.99 -\u003e 100% vs 0.99 -\u003e 99%)\n- And more...\n\nzuji gives you a method to cover these problems out of the box. **You won't have to learn a new formatting grammar or pour through MDN docs to get it right**.\n\n## Built-in Shortcuts\n\nThe easiest way to format numbers is using pre-configured shortcuts:\n\n- `standard-decimal` - Normal decimal with grouping and no rounding\n- `standard-integer` - Number with grouping rounded to integer\n- `compact-decimal` - Abbreviated number with shortened label\n- `compact-integer` - Abbreviated number rounded to integer\n- `standard-percent` - Percentage with grouping and decimals\n- `compact-percent` - Percentage without decimals\n- `standard-currency-usd` - US Dollar currency\n- `compact-currency-usd` - Abbreviated US Dollar currency\n- `accounting-currency-usd` - US Dollar with accounting notation\n- And more...\n\n## API Reference\n\nzuji takes two arguments:\n\n1. **value** - The number to format\n2. **options** - Either a pre-configured string shortcut or a typed `ZujiOptions` object\n\nThe `ZujiOptions` object supports all `Intl.NumberFormat` options including:\n\n- `style` - decimal, currency, percent, unit\n- `notation` - standard, scientific, engineering, compact\n- `unit` - kilometer, celsius, megabyte, etc.\n- `currency` - USD, EUR, JPY, etc.\n- `signDisplay` - auto, always, never, exceptZero\n- `roundingMode` - halfExpand, ceil, floor, etc.\n- And many more...\n\nSee the [full documentation](https://zuji-ts.vercel.app) for complete examples and API reference.\n\n## TypeScript\n\nzuji is written in TypeScript and exports helper types including `ZujiShortcut` and `ZujiOptions`. Intellisense and autocomplete with descriptive examples will show up in your editor for any option you provide.\n\n## Why the name?\n\nThe name zuji comes from the Japanese word sūji (数字), which means \"number\" or \"numeral\".\n\n## Playground\n\nSee the [interactive playground](https://zuji-ts.vercel.app/#playground) to explore the API and test out formatting options.\n\n## License\n\nMIT © [Kyle Gill](https://github.com/gillkyle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillkyle%2Fzuji","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgillkyle%2Fzuji","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgillkyle%2Fzuji/lists"}