chunkSplit

Splits a number or string into chunks of a specified size, separated by a specified string.
> chunkSplit(number | string, { groupSize?: number = 3, separator?: string = " " }): string
Parameters:
  • data: The number or string to split.
  • groupSize: The size of each chunk (default: `3`).
  • separator: The string to use between chunks (default: `" "`).
  • Returns: The result of the splited string.

Example

import { chunkSplit } from "@explita/daily-toolset";

chunkSplit(123456789, { groupSize: 3, separator: "," }); // "123,456,789"