1.0.0 • Published 10 years ago

charcount v1.0.0

Weekly downloads
47
License
MIT
Repository
github
Last release
10 years ago

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

1.0.0

10 years ago