Skip to content

Replacements for slice-ansi

fast-slice-ansi

fast-slice-ansi is a faster and smaller alternative to slice-ansi for slicing strings with ANSI escape codes.

ts
import sliceAnsi from 'slice-ansi'
import { sliceAnsi } from 'fast-slice-ansi'
import { styleText } from 'node:util'

const value = `The quick ${styleText('red', 'brown fox')} jumped over the lazy dog`

console.log(sliceAnsi(value, 10, 25))

Released under the MIT License. (aba2dbd5)