
Get the visual width of a string - the number of columns required to display it
Some Unicode characters are fullwidth and use double the normal width. ANSI escape codes are stripped and doesn't affect the width.
Useful to be able to measure the actual width of command-line output.
$ npm install string-width
const stringWidth = require('string-width'); stringWidth('古');//=> 2 stringWidth('\u001b[1m古\u001b[22m');//=> 2 stringWidth('a');//=> 1 MIT © Sindre Sorhus
Selectively mirror the npm registry inside your firewall. Filter packages based on security, licensing, code quality and more. Build awesome stuff faster. Try npm Enterprise for free…
string, str, character, char, unicode, width, visual, column, columns, fullwidth, full-width, full, ansi, escape, codes, cli, command-line, terminal, console, cjk, chinese, japanese, korean, fixed-width
is-fullwidth-code-point, strip-ansi
search-input-react, graphcool-inquirer, tidy-errors-webpack-plugin, carousel-react, cowsay, nyansay, dist-size, dn-cli4, gulp-reporter, string-break, bluemath, ascii-table-unicode, terminal-overwrite, @totvs/cli-utils, mapscii, @ionic/cli-utils, speedracer, magix-combine, npmtest-auto-install, primeng-custom, eclinter, @absolunet/cli, @absolunet/terminal-pad, customer-service, validate-tags, testen, logr-cli-fancy, textlint, gauge, begoo, cli-table2, table, string-width-cli, boxen, yosay, 2dg, cordova-plugin-amplify-pay, suman-inquirer, @offirmo/cli-toolbox, cli-format, inquirer-plus, sails-eslint, readline-ui, dmt-say, wide-align, vfile-reporter, super-badge, murky, web-component-tester-bundle, ansi-align, and more