@spare/bracket
v0.16.1
Published
Add parenthesis/bracket/brace/angle-bracket to string
Downloads
1,273
Readme
@spare/quote
A function returning string length, s.t. skipping ansi (escape) codes, correcting length of astral symbols.
Features
- ES2015 syntax
Install
$ npm install @spare/quote
Usage
import { quote } from '@spare/quote'
const list = [
'tolstoy',
'\u001b[3;4;31mhatsu\u001b[0m',
'\u{1F3C3}2\u{1F525}7',
]
for (let tx of list) {
console.log(`[${tx}] [length] (${tx.length}) [quote] (${quote(tx)})`)
}
Meta
Copyright (c) 2019-present, Haoyang (Vincent) Wang