source: trip-planner-front/node_modules/string-width/readme.md@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1# string-width
2
3> Get the visual width of a string - the number of columns required to display it
4
5Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
6
7Useful to be able to measure the actual width of command-line output.
8
9
10## Install
11
12```
13$ npm install string-width
14```
15
16
17## Usage
18
19```js
20const stringWidth = require('string-width');
21
22stringWidth('a');
23//=> 1
24
25stringWidth('古');
26//=> 2
27
28stringWidth('\u001B[1m古\u001B[22m');
29//=> 2
30```
31
32
33## Related
34
35- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
36- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
37- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
38
39
40---
41
42<div align="center">
43 <b>
44 <a href="https://tidelift.com/subscription/pkg/npm-string-width?utm_source=npm-string-width&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
45 </b>
46 <br>
47 <sub>
48 Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
49 </sub>
50</div>
Note: See TracBrowser for help on using the repository browser.