{"name":"string-width","version":"8.2.2","description":"Get the visual width of a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/string-width.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","wcwidth","wcswidth","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width","east-asian-width"],"dependencies":{"get-east-asian-width":"^1.5.0","strip-ansi":"^7.1.2"},"devDependencies":{"ava":"^6.4.1","tsd":"^0.33.0","xo":"^1.2.3"},"gitHead":"64dc20cddd374df0ff43ba3469491ae98cf0cdfc","types":"./index.d.ts","_id":"string-width@8.2.2","bugs":{"url":"https://github.com/sindresorhus/string-width/issues"},"homepage":"https://github.com/sindresorhus/string-width#readme","_nodeVersion":"24.18.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==","shasum":"7310516493df575742fe98af6fae87d85d5ed0ac","tarball":"http://registry-npm.ywwl.com/string-width/download/string-width-8.2.2.tgz","fileCount":5,"unpackedSize":11733,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCbq2VMT2NNV5K+Clr71aiGyFgdzQxar8nWBKif966flQIhAO1jGFen18lnsmON4X7Dvn6LNzcddmFXlHORDoj5vHYV"}],"size":4309,"noattachment":false,"key":"/string-width/-/string-width-8.2.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/string-width_8.2.2_1783543607220_0.1611467221893339"},"_hasShrinkwrap":false,"readme":"# string-width\n\n> Get the visual width of a string - the number of columns required to display it\n\nSome Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and do not affect the width.\n\nUseful to be able to measure the actual width of command-line output.\n\n## Install\n\n```sh\nnpm install string-width\n```\n\n## Usage\n\n```js\nimport stringWidth from 'string-width';\n\nstringWidth('a');\n//=> 1\n\nstringWidth('古');\n//=> 2\n\nstringWidth('\\u001B[1m古\\u001B[22m');\n//=> 2\n```\n\n## API\n\n### stringWidth(string, options?)\n\n#### string\n\nType: `string`\n\nThe string to be counted.\n\n#### options\n\nType: `object`\n\n##### ambiguousIsNarrow\n\nType: `boolean`\\\nDefault: `true`\n\nCount [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).\n\n> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). **If the context cannot be established reliably, they should be treated as narrow characters by default.**\n> - http://www.unicode.org/reports/tr11/\n\n##### countAnsiEscapeCodes\n\nType: `boolean`\\\nDefault: `false`\n\nWhether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.\n\n## Related\n\n- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module\n- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string\n- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string\n- [get-east-asian-width](https://github.com/sindresorhus/get-east-asian-width) - Determine the East Asian Width of a Unicode character\n","publish_time":1783543607396,"_cnpm_publish_time":1783543607396,"dist-tags":{"latest":"9.0.0","version4":"4.2.3"}}