Function split

Splits a string into an array of substrings based on a specified separator.

const source = 'Hello, world!';
const separator = ',';
split(separator)(source) // ['Hello', ' world!']
  • Parameters

    • separator: string | RegExp

    Returns (str: string) => string[]