{"name":"string-length","version":"4.0.2","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":"0656975df3a4378731b89f313ec60e5fb59ea088","bugs":{"url":"https://github.com/sindresorhus/string-length/issues"},"homepage":"https://github.com/sindresorhus/string-length#readme","_id":"string-length@4.0.2","_nodeVersion":"14.15.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==","shasum":"a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a","tarball":"http://registry-npm.ywwl.com/string-length/download/string-length-4.0.2.tgz","fileCount":5,"unpackedSize":4052,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgUaX3CRA9TVsSAnZWagAAkm4QAIeRssWNoufJj+uO29wW\nUgptdfPYdqP5cCsz1iy09bBWRXsfGAU75d/Z82sZ/16VMK6sIoftALf2B7Am\nzqAo55bQcfJfWxGaBsuwlMWDHE+AEDFDpgpfBWuELgWaMvCm4Ycn8zNBjDin\nZkYTpACQ5UP+YazIezjUlUDOCdumZ3+8OXm0s0L9/0JM8fCk0206jDhgEkRz\ntpojxB3JHke0eFEooxmZ3detEgWtPyxH4lEIHj+4WZNKYIYnV71svSiIDIBZ\nKfyv01Cj6KewHytBjlvXJisaQX+eZy4BFRnMpg8Wrz2vDaomxmUQMonGQyPf\nFpYojj1ZcAPQyQRqe7d/gEQs1xmCShvTClfiUUbSnVwFeTohEvbbOUMwKbxk\nkupaRrfN6zOFXtTnGa6A7bKQ/3rXkXbNFmfvknGQRHP5tYNFfldFvw6TT6JE\nVLPXmkknJwMPTDrFTcSadclEbZjti5r7MkIwJJe6468bKjMNO5gVpQZrBTJ6\nU00D8tdLvAr/lzhDwpS6NIRiAg+rIpqIgvTq7eBpDQ9ky36rs6ZHBJ5ErNqc\nz3Z/2LKidWTvFI+RJAw3QWg7bPN793tgjhMJvZrlU9ta+ZieNs3zzv5gCURc\n9zozdF2rcIbDxUEMmlURtnb2a3rGFcYHe6BwDMo4tazMc4deXoe7wDF6cwMo\nl+M/\r\n=XvqX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvrgjCx/IYD3QJ+S5AUScE1u/9WdaLfKa+/LwWk+Jq8QIhAK4TRGiokyJ6/lYFrt1MNZbCUSl5fxM9ZHK6X1Lnql0r"}],"size":1990,"noattachment":false,"key":"/string-length/-/string-length-4.0.2.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/string-length_4.0.2_1615963639274_0.20207543649070225"},"_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":1615963639439,"_cnpm_publish_time":1615963639439,"dist-tags":{"latest":"7.0.1"}}