{"id":50902946,"url":"https://github.com/stacksjs/ts-numbers","last_synced_at":"2026-06-16T04:31:29.024Z","repository":{"id":289916057,"uuid":"972754219","full_name":"stacksjs/ts-numbers","owner":"stacksjs","description":"🔢 Currencies, weights, and phone numbers. Localized \u0026 lightweight.","archived":false,"fork":false,"pushed_at":"2026-06-09T13:30:39.000Z","size":1027,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-06-09T15:05:40.437Z","etag":null,"topics":["currency","distance","numbers","phone","scientific-notation","temperature","typescript","weights"],"latest_commit_sha":null,"homepage":"https://ts-numbers.netlify.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/stacksjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["stacksjs","chrisbbreuer"],"open_collective":"stacksjs"}},"created_at":"2025-04-25T15:51:44.000Z","updated_at":"2026-06-09T13:05:24.000Z","dependencies_parsed_at":"2025-11-30T02:05:14.216Z","dependency_job_id":"735e4779-045e-4a3f-88f1-00d2ed0a2b07","html_url":"https://github.com/stacksjs/ts-numbers","commit_stats":null,"previous_names":["stacksjs/ts-numbers"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stacksjs/ts-numbers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fts-numbers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fts-numbers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fts-numbers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fts-numbers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stacksjs","download_url":"https://codeload.github.com/stacksjs/ts-numbers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fts-numbers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34391702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"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","distance","numbers","phone","scientific-notation","temperature","typescript","weights"],"created_at":"2026-06-16T04:31:28.354Z","updated_at":"2026-06-16T04:31:29.019Z","avatar_url":"https://github.com/stacksjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/stacksjs","https://github.com/sponsors/chrisbbreuer","https://opencollective.com/stacksjs"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\".github/art/cover.jpg\" alt=\"Social Card of ts-numbers\"\u003e\u003c/p\u003e\n\n[![npm version](https://img.shields.io/npm/v/ts-numbers?style=flat-square)](https://npmjs.com/package/ts-numbers)\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/stacksjs/ts-numbers/ci.yml?style=flat-square\u0026branch=main)](https://github.com/stacksjs/ts-numbers/actions?query=workflow%3Aci)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\n# ts-numbers\n\nA comprehensive, lightweight TypeScript library for formatting numbers, currencies, and handling numeric inputs with advanced features.\n\n## Features\n\n### Core Formatting\n\n- 🔢 [Versatile number formatting](https://ts-numbers.stacksjs.org/features/core-formatting) _with precise control over decimal places, separators, and more_\n- 💰 [Multiple currency support](https://ts-numbers.stacksjs.org/features/currency-support) _with automatic formatting_\n- 🌎 [Internationalization](https://ts-numbers.stacksjs.org/features/internationalization) _with locale-specific formatting and RTL support_\n- 🔣 [Scientific notation](https://ts-numbers.stacksjs.org/advanced/scientific-notation) _for large or small numbers_\n\n### Specialized Formats\n\n- 📞 [Phone number formatting](https://ts-numbers.stacksjs.org/features/specialized-formats#phone-numbers) _with various patterns_\n- 🌡️ [Temperature units](https://ts-numbers.stacksjs.org/advanced/unit-conversion#temperature-conversion) _with automatic conversion (°C, °F, K)_\n- ⚖️ [Weight units](https://ts-numbers.stacksjs.org/advanced/unit-conversion#weight-conversion) _with automatic conversion (kg, g, lb, oz)_\n- 📏 [Length units](https://ts-numbers.stacksjs.org/advanced/unit-conversion#length-conversion) _with automatic conversion (m, cm, mm, km, in, ft, yd, mi)_\n- ⏱️ [Time formatting](https://ts-numbers.stacksjs.org/features/specialized-formats#time-formatting) _(12h/24h)_\n- 🔢 [IP address formatting](https://ts-numbers.stacksjs.org/features/specialized-formats#ip-addresses) _(IPv4/IPv6)_\n- 💳 [Credit card number formatting](https://ts-numbers.stacksjs.org/features/specialized-formats#credit-card-formatting)\n\n### User Experience\n\n- ⌨️ [Input events](https://ts-numbers.stacksjs.org/features/input-events) _with automatic formatting and validation_\n- 📋 Copy/paste format conversion\n- 📱 Mobile-friendly with touch controls\n- ♿ Accessibility improvements _(ARIA attributes, screen reader support)_\n- 🎨 Customizable styling with themes\n\n### Advanced Features\n\n- 🧩 [Presets](https://ts-numbers.stacksjs.org/advanced/presets) _for common number formats_\n- 💾 [Extended persistence](https://ts-numbers.stacksjs.org/advanced/extended-persistence) _(localStorage, sessionStorage)_\n- 🔄 [History tracking](https://ts-numbers.stacksjs.org/features/input-events#custom-event-handlers) _with undo/redo functionality_\n- 📊 [Style rules](https://ts-numbers.stacksjs.org/advanced/style-rules) _for dynamic formatting based on value_\n\n## Installation\n\n```bash\n# npm\nnpm install ts-numbers\n\n# bun\nbun add ts-numbers\n\n# pnpm\npnpm add ts-numbers\n\n# yarn\nyarn add ts-numbers\n```\n\n## Quick Start\n\n```typescript\nimport { Numbers } from 'ts-numbers'\n\n// Create a new instance on an input element\nconst myNum = new Numbers('#amount', {\n  decimalPlaces: 2,\n  currencySymbol: '$',\n  digitGroupSeparator: ',',\n})\n\n// Set a value\nmyNum.set(1234.56) // Will display as \"$1,234.56\"\n\n// Get the numeric value\nconst value = myNum.getNumber() // Returns 1234.56\n```\n\nSee [Usage Guide](https://ts-numbers.stacksjs.org/usage) for more examples.\n\n## Configuration\n\nts-numbers supports extensive configuration options:\n\n```typescript\nconst config = {\n  // Core formatting options\n  decimalPlaces: 2,\n  decimalCharacter: '.',\n  digitGroupSeparator: ',',\n  currencySymbol: '$',\n\n  // Keyboard shortcuts\n  keyboardShortcuts: {\n    increment: 'Alt+ArrowUp',\n    decrement: 'Alt+ArrowDown',\n    toggleSign: 'Alt+-',\n    clear: 'Alt+C',\n  },\n\n  // Multiple currencies\n  currencies: {\n    USD: { symbol: '$', placement: 'p', decimalPlaces: 2 },\n    EUR: { symbol: '€', placement: 's', decimalPlaces: 2 },\n    JPY: { symbol: '¥', placement: 'p', decimalPlaces: 0 }\n  },\n\n  // Specialized formatting\n  useScientificNotation: true,\n  scientificNotationThreshold: 1000000,\n\n  // Localization\n  locale: 'en-US',\n\n  // Accessibility\n  ariaLabel: 'Amount in dollars'\n}\n\nconst myNum = new Numbers('#amount', config)\n```\n\nSee [Configuration Guide](https://ts-numbers.stacksjs.org/config) for the full list of options.\n\n## Advanced Examples\n\n### Multiple Currencies\n\n```typescript\n// Configure with multiple currencies\nconst myNum = new Numbers('#amount', {\n  currencies: {\n    USD: { symbol: '$', placement: 'p', decimalPlaces: 2 },\n    EUR: { symbol: '€', placement: 's', decimalPlaces: 2 },\n    JPY: { symbol: '¥', placement: 'p', decimalPlaces: 0 }\n  },\n  activeCurrency: 'USD'\n})\n\n// Switch currency\nmyNum.setCurrency('EUR')\n```\n\n### Scientific Notation\n\n```typescript\nconst myNum = new Numbers('#amount', {\n  useScientificNotation: true,\n  scientificNotationThreshold: 1000000\n})\n\nmyNum.set(1234567) // Will display as \"1.23e+6\"\n```\n\n### Data Persistence\n\n```typescript\nconst myNum = new Numbers('#amount', {\n  persistenceMethod: 'localStorage',\n  persistenceKey: 'user-amount'\n})\n```\n\nFor more advanced examples, see the [Advanced Features](https://ts-numbers.stacksjs.org/advanced/presets) section of the documentation.\n\n## Testing\n\nRun the test suite with:\n\n```bash\nbun test\n```\n\n## Changelog\n\nPlease see our [releases](https://github.com/stackjs/clapp/releases) page for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Community\n\nFor help, discussion about best practices, or any other conversation that would benefit from being searchable:\n\n[Discussions on GitHub](https://github.com/stacksjs/clapp/discussions)\n\nFor casual chit-chat with others using this package:\n\n[Join the Stacks Discord Server](https://discord.gg/stacksjs)\n\n## Postcardware\n\n“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where `ts-numbers` is being used! We showcase them on our website too.\n\nOur address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎\n\n## Credits\n\n- [Autonumeric](https://github.com/autoNumeric/autoNumeric) - The original inspiration for this library\n\n## Sponsors\n\nWe would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.\n\n- [JetBrains](https://www.jetbrains.com/)\n- [The Solana Foundation](https://solana.com/)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.\n\nMade with 💙\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fts-numbers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstacksjs%2Fts-numbers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fts-numbers/lists"}