JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 37780205
  • Score
    100M100P100Q234159F
  • License MIT

Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes

Package Exports

  • string-length

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-length) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

string-length Build Status

Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes

String#length errornously counts astral symbols as two characters.

Install

$ npm install --save string-length
$ bower install --save string-length
$ component install sindresorhus/string-length

Usage

'𐌢'.length;
//=> 2

stringLength('𐌢');
//=> 1

stringLength('\x1b[1municorn\x1b[22m');
//=> 7

License

MIT © Sindre Sorhus