1 | ## @spare/charset
|
2 | A function returning string length,
|
3 | s.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/charset
|
22 | ```
|
23 |
|
24 | ## Usage
|
25 | ```js
|
26 | import { lange } from '@spare/charset'
|
27 | const list = [
|
28 | 'tolstoy',
|
29 | '\u001b[3;4;31mhatsu\u001b[0m',
|
30 | '\u{1F3C3}2\u{1F525}7',
|
31 | ]
|
32 | for (let tx of list) {
|
33 | console.log(`[${tx}] [length] (${tx.length}) [lange] (${lange(tx)})`)
|
34 | }
|
35 | ```
|
36 |
|
37 | ## Meta
|
38 | [LICENSE (MIT)](/LICENSE)
|
39 |
|
40 | Copyright (c) 2019-present, Haoyang (Vincent) Wang
|
41 |
|
42 | [//]: <> (Shields)
|
43 | [npm-image]: https://img.shields.io/npm/v/@spare/charset.svg?style=flat-square
|
44 | [quality-image]: http://npm.packagequality.com/shield/@spare/charset.svg?style=flat-square
|
45 | [download-image]: https://img.shields.io/npm/dm/@spare/charset.svg?style=flat-square
|
46 | [total-download-image]:https://img.shields.io/npm/dt/@spare/charset.svg?style=flat-square
|
47 | [license-image]: https://img.shields.io/npm/l/@spare/charset.svg?style=flat-square
|
48 | [commit-image]: https://img.shields.io/github/commit-activity/y/hoyeungw/spare/charset?style=flat-square
|
49 | [size]: https://flat.badgen.net/packagephobia/install/@spare/charset
|
50 |
|
51 | [//]: <> (Link)
|
52 | [npm-url]: https://npmjs.org/package/@spare/charset
|
53 | [quality-url]: http://packagequality.com/#?package=@spare/charset
|
54 | [github-url]: https://github.com/hoyeungw/@spare/charset
|
55 | [size-url]: https://packagephobia.now.sh/result?p=@spare/charset
|