{"name":"string-length","version":"5.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"},"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.1"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.44.0"},"gitHead":"a1cdfe8c1f2e57832a4bba741bfca292e69d681c","bugs":{"url":"https://github.com/sindresorhus/string-length/issues"},"homepage":"https://github.com/sindresorhus/string-length#readme","_id":"string-length@5.0.1","_nodeVersion":"12.22.1","_npmVersion":"7.20.3","dist":{"integrity":"sha512-9Ep08KAMUn0OadnVaBuRdE2l615CQ508kr0XMadjClfYpdCyvrbFp6Taebo8yyxokQ4viUd/xPPUA4FGgUa0ow==","shasum":"3d647f497b6e8e8d41e422f7e0b23bc536c8381e","tarball":"http://registry-npm.ywwl.com/string-length/download/string-length-5.0.1.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\nwsFcBAEBCAAQBQJhP5aDCRA9TVsSAnZWagAAGpcQAI5dwdBnoVHAYdI8XdIB\nZGVp+zhTmGmLGeAepQUTT/1ViwelKNK72CccRkftbotq+PPxvYNBp856mpRS\n52lIaigl0vuY6zjNaByMkWe+2XGfxttff7QibnNRquB7DYFe2M0cUlqTyQTs\n3UVZFOxviTlU6V7O0t2bEBFTIUecFeOlhpzgOKo/4z2EI+1IS2c4CTLbnEXM\neeHKawVRlLd3LC5L0NHbPdcV7cLl42x6qEhZuHGM0uyILai4Tk9lba+zwSb+\ngWZ3fbrFzHYwbtPgPofuD6FtZnadETdd2xD1cNtr5zkBpskSnmHBo7WKA3/C\nuUwiWkC3L0zwm01hm1mqIFLZZ04X7dj315OT97SbOy4GVtwTLrPPWGUGoeWc\nHr7auHztKr+HXo7OfzyfxrKWuf/7PcNja+wkywbPEXEtBSwTZBwQlwTvt/mx\ne6FQUwWIU13bSY31FsP56Ov+fvUxTZgLVvPfb5R3xW0PmdwdMtuB1/zCxYVi\npKu9ndabDZcy+KBKl62xOn2s2SxFfYvOok3oTdC2LqfAqvRfFZ7+uo0sWPls\niwMQC836CSitg1ZTSF530xEmSOxo9xrWOZNeaN4YYyJ7dng5APUUXP4jH2kR\nRCWH0mUKZFmh3rZHMFDXRhLR5iy11dacKedB6qJcjoNbnSTcAL3kvHaU2EWH\nlh6T\r\n=hHCg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2nnTH0tGemCj4d63yZL0GTmkzvQAZMhP3Kpt1z+nB6AIgYNiSVxwH6PYP2e8jihlWhr9FDOSsWqFqJVyTqv1IMQw="}],"size":2168,"noattachment":false,"key":"/string-length/-/string-length-5.0.1.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.1_1631557250714_0.4392555917221974"},"_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":1631557251093,"_cnpm_publish_time":1631557251093,"dist-tags":{"latest":"7.0.1"}}