{"name":"string-width","version":"8.1.1","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"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"string-width@8.1.1","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/string-width#readme","bugs":{"url":"https://github.com/sindresorhus/string-width/issues"},"dist":{"shasum":"9b5aa0df72e3f232611c57fd47eb41dd97866bd3","tarball":"http://registry-npm.ywwl.com/string-width/download/string-width-8.1.1.tgz","fileCount":5,"integrity":"sha512-KpqHIdDL9KwYk22wEOg/VIqYbrnLeSApsKT/bSj6Ez7pn3CftUiLAv2Lccpq1ALcpLV9UX1Ppn92npZWu2w/aw==","signatures":[{"sig":"MEUCIQDFjHIqLPmIFiIdR1MCmZ5YPviO6S0Vb621sZ2yjP9jawIgf0+g4mNY6YmEmnGcfREScaED/JF5wcqyf6GkjlVdG2c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8049,"size":3199,"noattachment":false,"key":"/string-width/-/string-width-8.1.1.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"d3bd08603bb3f7cacc93f84140036692501d59fc","scripts":{"test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/string-width.git","type":"git"},"_npmVersion":"11.7.0","description":"Get the visual width of a string - the number of columns required to display it","directories":{},"sideEffects":false,"_nodeVersion":"25.3.0","dependencies":{"strip-ansi":"^7.1.0","get-east-asian-width":"^1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1","tsd":"^0.33.0"},"_npmOperationalInternal":{"tmp":"tmp/string-width_8.1.1_1769658161226_0.5537279228935534","host":"s3://npm-registry-packages-npm-production"},"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":1769658161370,"_cnpm_publish_time":1769658161370,"dist-tags":{"latest":"9.0.0","version4":"4.2.3"}}