{"name":"string-length","version":"5.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+https://github.com/sindresorhus/string-length.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=12.20"},"type":"module","exports":"./index.js","scripts":{"test":"xo && ava && tsd"},"keywords":["unicode","string","length","size","count","astral","symbol","surrogates","codepoints","ansi","escape","codes"],"dependencies":{"char-regex":"^2.0.0","strip-ansi":"^7.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.40.2"},"gitHead":"00b57061333f0d3f416b3d6e591b626dc5633502","bugs":{"url":"https://github.com/sindresorhus/string-length/issues"},"homepage":"https://github.com/sindresorhus/string-length#readme","_id":"string-length@5.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-1qjpci3h1G7BUi6dt5uAVyrO2FMUdjj3XWU970/eQh0YKhlYZ8bJMC/+BUpD21YdEhmuHv2nnbUUn024+cC7YQ==","shasum":"fc6c1de7850d81255d944d10951ae65c7304d228","tarball":"http://registry-npm.ywwl.com/string-length/download/string-length-5.0.0.tgz","fileCount":5,"unpackedSize":4631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgu4/RCRA9TVsSAnZWagAAeXUP/3zkKX3hm5FFBlirnZMN\nDfd+LDaWiNvjZa9N2/YIiqSqM67aii7A3P5Fy5pl1CSN3I3yGdA60M3sdF5h\nPrYTWuuvs2eIu75jmArwuzek56ZK0vrn5IcUsRsdeAaw2tLYPmrSEm5i0zaZ\nxWk1kH8/9BoJn5WjEeoeTTckD8YPqHwjW/yiVoYBqvuQg4qaDKvVs/ZPyrB8\nEDnIgIFzbdbnmH+T8QTIdFcze+R4AIP3cppKMH0KLEVwzR4ZruMDS1uTBMqB\nU5MyIDgATgJZhZwmFt8kB4m/t4qExjBuxWaYkNmbH3ZhzQIeXOwbh6bDBumL\nMzW1LO+B5GrC/J8EKt9PwuWgVjyG1nWgKYy6MKBUzOTkCIEY5OaeQAafqlKp\nSx5YaKIEmvz/3ImR76aTQOpfop3rBm8j1y4rF5YOgOYpx+Qq8tcOM0ZyJTmy\nS1u+OcirwZZo7i3OPnJkPR5CUzIi2xI2M3GU3fO2JvaHlZZpt6P3G8MH0Q+O\n08JVs/yCu4NwriNc7cJDxeIvPgbN3c+GC+Art3ydTP7aAJnX7YdGG+U7CzRi\n82i5RR031wXkc4bRontREIraVPgS6ofHPdq0YwEERTQhlSeAxzy0WouAV3fo\nV9ZJed3gSfpLifq+HOxiHceDoq4CfSpuMnSRgm942kZXi2of8saWtAKAiYQL\nUiO7\r\n=o1Vf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC9d65fsrCABYi33GcM8Z6b/PJnKpvf+aN5cjKoY2tJ1gIhANGLqSwK0dGhT0wrGBOZz0HHjeh2kgRJpxaBQlJWQdxo"}],"size":2168,"noattachment":false,"key":"/string-length/-/string-length-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-length_5.0.0_1622904784877_0.07725316336050447"},"_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":1622904785037,"_cnpm_publish_time":1622904785037,"dist-tags":{"latest":"7.0.1"}}