SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE
Current File : /opt/alt/alt-nodejs12/root/usr/lib/node_modules/npm/node_modules.bundled/string-width//readme.md
# string-width [](https://travis-ci.org/sindresorhus/string-width)
> Get the visual width of a string - the number of columns required to display it
Some 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.
Useful to be able to measure the actual width of command-line output.
## Install
```
$ npm install string-width
```
## Usage
```js
const stringWidth = require('string-width');
stringWidth('古');
//=> 2
stringWidth('\u001b[1m古\u001b[22m');
//=> 2
stringWidth('a');
//=> 1
```
## Related
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
| NAME |
SIZE |
LAST TOUCH |
USER |
CAN-I? |
FUNCTIONS |
| .. | -- | 31 Aug 2024 8.02 AM | root / root | 0755 | |
| node_modules | -- | 31 Aug 2024 8.02 AM | root / root | 0755 | |
| | | | | |
| index.js | 0.634 KB | 11 Jan 2022 8.49 AM | root / root | 0644 | |
| license | 1.083 KB | 11 Jan 2022 8.49 AM | root / root | 0644 | |
| package.json | 2.074 KB | 11 Jan 2022 8.49 AM | root / root | 0644 | |
| readme.md | 1.123 KB | 11 Jan 2022 8.49 AM | root / root | 0644 | |