$ npm install power-assert-util-string-width
Calculates width of given string. Treat ambiguous-width characters as fullwidth (= 2
) by default.
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
$ npm install --save-dev power-assert-util-string-width
Licensed under the MIT license.
© 2010 - cnpmjs.org x YWFE | Home | YWFE