charcount

1.0.0 • Public • Published

charcount

Build Status NPM version

Count visual length of javascript string.

Some symbols in JavaScript can occupy 2 characters (surrogate pair). This package count string length as you see it in browser:

var charcount = require('charcount');
 
console.log(charcount('😀')); // => 1
console.log('😀'.length);     // => 2

Related projects

If you works with strings for terminal output, you may wish to ignore ASCII escape sequences. See those projects then:

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i charcount

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • vitaly