{"name":"string-length","version":"1.0.0","description":"Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/string-length"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js"],"keywords":["unicode","string","str","length","astral","symbol","surrogates","codepoints","ansi","escape","codes"],"dependencies":{"strip-ansi":"^2.0.0"},"devDependencies":{"mocha":"*"},"gitHead":"5aa9b5946c927c2884a49741a066fdb3f30a6aa1","bugs":{"url":"https://github.com/sindresorhus/string-length/issues"},"homepage":"https://github.com/sindresorhus/string-length","_id":"string-length@1.0.0","_shasum":"5f0564b174feb299595a763da71513266370d3a9","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"dist":{"shasum":"5f0564b174feb299595a763da71513266370d3a9","tarball":"http://registry-npm.ywwl.com/string-length/download/string-length-1.0.0.tgz","integrity":"sha512-Ix7an0W1kNzF/vf6U5y0dNBJ0eFe8OIz4DcgDVOAKX/hLgU9I7//dMhuS9AvxZP4p5Sp6adP68IKUQIeGe2zdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF/ge6MEurzCRjdyeklvv/UV+duRqHJvZUm4VzhuWA33AiA3MSYPA7MiiuP1tclXX8GuGOysB6mL5/ttxvYgNzNBtw=="}],"size":947,"noattachment":false,"key":"/string-length/-/string-length-1.0.0.tgz"},"directories":{},"readme":"# string-length\n\n> Get the real length of a string - by correctly counting astral symbols and ignoring [ansi escape codes](https://github.com/sindresorhus/strip-ansi)\n\n`String#length` erroneously counts [astral symbols](https://web.archive.org/web/20150721114550/http://www.tlg.uci.edu/~opoudjis/unicode/unicode_astral.html) as two characters.\n\n## Install\n\n```sh\nnpm install string-length\n```\n\n## Usage\n\n```js\nimport stringLength from 'string-length';\n\n'🐴'.length;\n//=> 2\n\nstringLength('🐴');\n//=> 1\n\nstringLength('\\u001B[1municorn\\u001B[22m');\n//=> 7\n```\n\n## API\n\n### stringLength(string, options?)\n\n#### options\n\nType: `object`\n\n##### countAnsiEscapeCodes\n\nType: `boolean`\\\nDefault: `false`\n\nWhether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted. They are ignored by default.\n\n## Related\n\n- [string-length-cli](https://github.com/LitoMore/string-length-cli) - CLI for this module\n- [string-width](https://github.com/sindresorhus/string-width) - Get visual width of a string\n","publish_time":1407937033130,"_cnpm_publish_time":1407937033130,"dist-tags":{"latest":"7.0.1"}}