{"name":"string-length","version":"4.0.1","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+https://github.com/sindresorhus/string-length.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=10"},"scripts":{"test":"xo && ava && tsd"},"keywords":["unicode","string","length","size","count","astral","symbol","surrogates","codepoints","ansi","escape","codes"],"dependencies":{"char-regex":"^1.0.2","strip-ansi":"^6.0.0"},"devDependencies":{"ava":"^3.1.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"20a1ad355fbbc11c9b3c4194e70c1302596ea17f","bugs":{"url":"https://github.com/sindresorhus/string-length/issues"},"homepage":"https://github.com/sindresorhus/string-length#readme","_id":"string-length@4.0.1","_nodeVersion":"10.18.1","_npmVersion":"6.14.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-PKyXUd0LK0ePjSOnWn34V2uD6acUWev9uy0Ft05k0E8xRW+SKcA0F7eMr7h5xlzfn+4O3N+55rduYyet3Jk+jw==","shasum":"4a973bf31ef77c4edbceadd6af2611996985f8a1","tarball":"http://registry-npm.ywwl.com/string-length/download/string-length-4.0.1.tgz","fileCount":5,"unpackedSize":4101,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJec5/1CRA9TVsSAnZWagAAZs0P/1UwoOmVWj2JriHeofBO\nHHhy8TyFo/HIXNO5Apz8rDzadNnKoTGVmUWD4rBbPEfOqG2jpc75R9lKxS+7\nGwLJDdp8Tl+0RfXWCQDZKXD6Et6sSw7fEoKgwSu5LjdCtDc1MIMJCw/hKIpi\n7etcxvVj4od/Z/aN+xlXCaObIQgRsSHDH02RGzW1gV4MzIa6DlrrzCUOWF6c\nC+9yH6wQv7045WkHOjFrl1SxubSZxJ0L5O7W/f2yyGtrF5efUooCPv+lOdTl\nv6estwxbVxUN8b5yZBxWn8toj9wLAnuUqAxDLbsFAu/leBu7yHTIrPvc2hlP\nZBsso4FxgBLjhZaa5OudNwiItUrQR5dqeyy3ziO5R3pRaIfdnQWFqAXVCorM\nBvhrxkbbkWxL/Tz5n/cRDWxDIo9T9xoNW34xFmDdYCMq/csJrWNjh+phJ7SF\nhR2de534DS7IRRFm9nXtuUkjP4fYm1POx8C/hI5lu+VnP7juaTvf3LuemzSs\ndLfm5O9XOoG4T1FOj/Km/3F9SEayEtZO4LPxfBWfe7uZcnENbVjhZDuSgHPC\nJ6nPLDhxEOP43QvQOMnsN+FefNTnebF12mgFq+3fk9bCQqcEIjN0BLjctnt1\nI/DMR3ljnpIQz8Hl8Dm5ac0HHy2EgA41H2icV6E5eYnDfSuNmytD9OSIhcwv\nq92f\r\n=CwcQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmia7i4vjdsFmRBKjvIV8hB7oAp7oR8kRggcx5KHIe/AIgbxeIwOtG4GaKIpmDQVoF1OwFBwIE3NQkVWs/HAJhlAs="}],"size":2012,"noattachment":false,"key":"/string-length/-/string-length-4.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-length_4.0.1_1584635892393_0.5498585482578426"},"_hasShrinkwrap":false,"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":1584635892544,"_cnpm_publish_time":1584635892544,"dist-tags":{"latest":"7.0.1"}}