Skip to main content

Built and signed on GitHub Actions

Number to String (short scale & long scale) converter

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
a month ago (0.6.1)
Package root>split.ts
function splitAt(str = "", index = 0) { return [str.slice(0, index), str.slice(index)]; } /** * Splits `input` into an array of parts of length `partSize` * @param input input value * @param partSize length of each part * @returns array of the parts */ export function split(input = "", partSize = 3) { const [firstPart, rest] = splitAt(input, input.length % partSize); return [ firstPart, ...rest.match(new RegExp(`.{1,${partSize}}`, "g")) ?? [], ].filter(Boolean).map(Number); }