Skip to content

Commit 2107e00

Browse files
authored
feat(preferred): add fast-slice-ansi to replacements (#724)
1 parent 64590ca commit 2107e00

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎docs/modules/slice-ansi.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: Modern alternatives for the slice-ansi package for slicing terminal strings
3+
---
4+
5+
# Replacements for `slice-ansi`
6+
7+
## `fast-slice-ansi`
8+
9+
[`fast-slice-ansi`](https://github.com/43081j/fast-slice-ansi) is a faster and smaller alternative to `slice-ansi` for slicing strings with ANSI escape codes.
10+
11+
```ts
12+
import sliceAnsi from 'slice-ansi' // [!code --]
13+
import { sliceAnsi } from 'fast-slice-ansi' // [!code ++]
14+
import { styleText } from 'node:util'
15+
16+
const value = `The quick ${styleText('red', 'brown fox')} jumped over the lazy dog`
17+
18+
console.log(sliceAnsi(value, 10, 25))
19+
```

‎manifests/preferred.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,12 @@
25182518
"replacements": ["nanoid"],
25192519
"url": {"type": "e18e", "id": "shortid"}
25202520
},
2521+
"slice-ansi": {
2522+
"type": "module",
2523+
"moduleName": "slice-ansi",
2524+
"replacements": ["fast-slice-ansi"],
2525+
"url": {"type": "e18e", "id": "slice-ansi"}
2526+
},
25212527
"sort-object": {
25222528
"type": "module",
25232529
"moduleName": "sort-object",
@@ -3043,6 +3049,11 @@
30433049
"type": "documented",
30443050
"replacementModule": "fast-querystring"
30453051
},
3052+
"fast-slice-ansi": {
3053+
"id": "fast-slice-ansi",
3054+
"type": "documented",
3055+
"replacementModule": "fast-slice-ansi"
3056+
},
30463057
"fast-string-width": {
30473058
"id": "fast-string-width",
30483059
"type": "documented",

0 commit comments

Comments
 (0)