Skip to content

explode

Module Export

text |> (separator: text) => [text]

Splits a text into an iterator of texts based on a given separator pattern

explode takes a text and splits it by a given separator, returning an iterator of each part (excluding the separator).

Examples

Split a path into segments

import { explode } from 'text'
from 'root/folder/file' explode '/'
// Returns:
['root', 'folder', 'file']