{"id":"hollower233/numberformat","name":"numberformat","scope":"hollower233","platform":"roblox","description":"Luau utilities for formatting numbers, currency, and time, and parsing them back into numbers.","version":"0.1.2","latest":"0.1.2","versions":["0.1.0","0.1.1","0.1.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"0e330735ae14499f590ef20bbe2254e74d7a7111cd5594f0267f4b35fe19fe04","likes":0,"downloads":0,"install":"forest install hollower233/numberformat","url":"https://forest.dev/p/roblox/hollower233/numberformat","files":"https://api.forest.dev/ai/package/roblox/hollower233/numberformat/files","readme":"# NumberFormat\n\nLuau utilities for formatting numbers, currency, and time — and parsing them back into numbers.\n\nA pure-Luau port of [`@rbxts/formatting`](https://github.com/R-unic/rbx-formatting) (originally written for roblox-ts), rewritten for plain Luau/Wally projects.\n\n## Installation\n\nAdd to your `wally.toml`:\n\n```toml\n[dependencies]\nNumberFormat = \"hollower233/numberformat@0.1.0\"\n```\n\nThen run:\n\n```bash\nwally install\n```\n\n## API\n\n### Number formatting\n\n```lua\nlocal NumberFormat = require(ReplicatedStorage.Packages.NumberFormat)\n\nNumberFormat.commaFormat(1000000) --> \"1,000,000\"\nNumberFormat.abbreviate(1000000) --> \"1M\"\nNumberFormat.abbreviate(1000000000000000000) --> \"1Qt\"\nNumberFormat.parseAbbreviated(\"1B\") --> 1000000000\n```\n\n- `commaFormat(n: number | string, minimum: number?, separator: string?, decimal: string?): string`\n  Places commas (or a custom separator) between every three digits.\n- `abbreviate(n: number, threshold: number?, suffixes: {string}?): string`\n  Abbreviates numbers at or above `threshold` (default `1000`) using suffixes like `K`, `M`, `B`, ...\n- `parseAbbreviated(suffixed: string, suffixes: {string}?): number`\n  Parses a string produced by `abbreviate()` back into a number.\n\n### Time formatting\n\n```lua\nNumberFormat.toSeconds(\"10m 20s\") --> 620\nNumberFormat.toRemainingTime(310) --> \"5m 10s\"\nNumberFormat.toLongRemainingTime(3690) --> \"01:01:30\"\n```\n\n- `toSeconds(time: string): number`\n  Converts a time string (e.g. `\"1h 5m\"`) into seconds.\n- `toRemainingTime(seconds: number, secondsFormat: string?, minutesFormat: string?, hoursFormat: string?, daysFormat: string?): string`\n  Converts seconds into a short remaining-time string.\n- `toLongRemainingTime(seconds: number): string`\n  Converts seconds into an `HH:MM:SS` string.\n\n## License\n\nMIT\n","readmeTruncated":false}