UNPKG

1.82 kBMarkdownView Raw
1## @spare/regex-charset
2A function returning string length,
3s.t.
4 skipping ansi (escape) codes,
5 correcting length of astral symbols.
6
7[![npm version][npm-image]][npm-url]
8[![npm quality][quality-image]][quality-url]
9[![npm download][download-image]][npm-url]
10[![npm total-download][total-download-image]][npm-url]
11[![size][size]][size-url]
12[![github commit activity][commit-image]][github-url]
13[![npm license][license-image]][npm-url]
14
15## Features
16
17- ES2015 syntax
18
19## Install
20```console
21$ npm install @spare/regex-charset
22```
23
24## Usage
25```js
26import { lange } from '@spare/regex-charset'
27const list = [
28 'tolstoy',
29 '\u001b[3;4;31mhatsu\u001b[0m',
30 '\u{1F3C3}2\u{1F525}7',
31]
32for (let tx of list) {
33 console.log(`[${tx}] [length] (${tx.length}) [lange] (${lange(tx)})`)
34}
35```
36
37## Meta
38[LICENSE (MIT)](/LICENSE)
39
40Copyright (c) 2019-present, Haoyang (Vincent) Wang
41
42[//]: <> (Shields)
43[npm-image]: https://img.shields.io/npm/v/@spare/regex-charset.svg?style=flat-square
44[quality-image]: http://npm.packagequality.com/shield/@spare/regex-charset.svg?style=flat-square
45[download-image]: https://img.shields.io/npm/dm/@spare/regex-charset.svg?style=flat-square
46[total-download-image]:https://img.shields.io/npm/dt/@spare/regex-charset.svg?style=flat-square
47[license-image]: https://img.shields.io/npm/l/@spare/regex-charset.svg?style=flat-square
48[commit-image]: https://img.shields.io/github/commit-activity/y/hoyeungw/spare/regex-charset?style=flat-square
49[size]: https://flat.badgen.net/packagephobia/install/@spare/regex-charset
50
51[//]: <> (Link)
52[npm-url]: https://npmjs.org/package/@spare/regex-charset
53[quality-url]: http://packagequality.com/#?package=@spare/regex-charset
54[github-url]: https://github.com/hoyeungw/@spare/regex-charset
55[size-url]: https://packagephobia.now.sh/result?p=@spare/regex-charset