Skip to content

Files

Latest commit

Jun 12, 2018
ca04f48 · Jun 12, 2018

History

History

power-assert-util-string-width

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 7, 2016
Oct 6, 2016
Jul 7, 2016
Jun 12, 2018

power-assert

Build Status NPM version License

Calculates width of given string. Treat ambiguous-width characters as fullwidth (= 2) by default.

USAGE

var stringWidth = require('power-assert-util-string-width');
stringWidth('abcde'); //=> 5
stringWidth('あいうえお'); //=> 10
stringWidth('アイウエオ'); //=> 5
stringWidth('※脚注');  //=> 6
// stringWidth.narrow treats ambiguous-width characters as narrow (= `1`)
stringWidth.narrow('※脚注');  //=> 5

INSTALL

$ npm install --save-dev power-assert-util-string-width

AUTHOR

LICENSE

Licensed under the MIT license.