{"_id":"get-east-asian-width","_rev":"296224","name":"get-east-asian-width","description":"Determine the East Asian Width of a Unicode character","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2024-01-01T17:35:21.000Z","created":"2023-10-28T12:04:13.231Z","1.2.0":"2023-10-29T16:04:16.978Z","1.1.0":"2023-10-29T13:20:04.140Z","1.0.0":"2023-10-28T12:04:13.231Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/get-east-asian-width.git"},"versions":{"1.2.0":{"name":"get-east-asian-width","version":"1.2.0","description":"Determine the East Asian Width of a Unicode character","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/get-east-asian-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"},"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts","build":"node scripts/build.js","prepublish":"npm run build"},"keywords":["unicode","east-asian-width","eastasianwidth","character","string","width","text","layout","alignment","fullwidth","halfwidth","ambiguous","narrow","wide","neutral","typography","japanese","chinese","korean","codepoint","text-processing","i18n","l10n"],"devDependencies":{"ava":"^5.3.1","indent-string":"^5.0.0","outdent":"^0.8.0","simplify-ranges":"^0.1.0","typescript":"^5.2.2","xo":"^0.56.0"},"xo":{"ignores":["lookup.js"]},"types":"./index.d.ts","gitHead":"8b6a63bed875c0f6c5683967a2360fd14dba7b80","bugs":{"url":"https://github.com/sindresorhus/get-east-asian-width/issues"},"homepage":"https://github.com/sindresorhus/get-east-asian-width#readme","_id":"get-east-asian-width@1.2.0","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"shasum":"5e6ebd9baee6fb8b7b6bd505221065f0cd91f64e","size":4518,"noattachment":false,"key":"/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz","tarball":"http://name.csiicloud.com:7001/get-east-asian-width/download/get-east-asian-width-1.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-east-asian-width_1.2.0_1698595456827_0.39333670603250437"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-29T16:04:16.978Z","publish_time":1698595456978,"_source_registry_name":"default","_cnpm_publish_time":1698595456978},"1.1.0":{"name":"get-east-asian-width","version":"1.1.0","description":"Determine the East Asian Width of a Unicode character","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/get-east-asian-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"},"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts","build":"node scripts/build.js","prepublish":"npm run build"},"keywords":["unicode","east-asian-width","eastasianwidth","character","string","width","text","layout","alignment","fullwidth","halfwidth","ambiguous","narrow","wide","neutral","typography","japanese","chinese","korean","codepoint","text-processing","i18n","l10n"],"devDependencies":{"ava":"^5.3.1","indent-string":"^5.0.0","outdent":"^0.8.0","simplify-ranges":"^0.1.0","typescript":"^5.2.2","xo":"^0.56.0"},"xo":{"ignores":["lookup.js"]},"types":"./index.d.ts","gitHead":"0ab1462b12c2fd39515accaaaa54f07007304102","bugs":{"url":"https://github.com/sindresorhus/get-east-asian-width/issues"},"homepage":"https://github.com/sindresorhus/get-east-asian-width#readme","_id":"get-east-asian-width@1.1.0","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"shasum":"c37e1eb4346ab41cccd76c3eedac5c31f825f8f8","size":4369,"noattachment":false,"key":"/get-east-asian-width/-/get-east-asian-width-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/get-east-asian-width/download/get-east-asian-width-1.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-east-asian-width_1.1.0_1698585603953_0.5432821755832502"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-29T13:20:04.140Z","publish_time":1698585604140,"_source_registry_name":"default","_cnpm_publish_time":1698585604140},"1.0.0":{"name":"get-east-asian-width","version":"1.0.0","description":"Determine the East Asian Width of a Unicode character","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/get-east-asian-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"},"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts","build":"node scripts/build.js","prepublish":"npm run build"},"keywords":["unicode","east-asian-width","eastasianwidth","character","string","width","text","layout","alignment","fullwidth","halfwidth","ambiguous","narrow","wide","neutral","typography","japanese","chinese","korean","codepoint","text-processing","i18n","l10n"],"devDependencies":{"ava":"^5.3.1","simplify-ranges":"^0.1.0","typescript":"^5.2.2","xo":"^0.56.0"},"xo":{"ignores":["lookup.js"]},"types":"./index.d.ts","gitHead":"367c6645473bcce36c6c812081427c5cf78edcea","bugs":{"url":"https://github.com/sindresorhus/get-east-asian-width/issues"},"homepage":"https://github.com/sindresorhus/get-east-asian-width#readme","_id":"get-east-asian-width@1.0.0","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"shasum":"762072a7df71098c225ac9d239c95f117e507128","size":9397,"noattachment":false,"key":"/get-east-asian-width/-/get-east-asian-width-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/get-east-asian-width/download/get-east-asian-width-1.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-east-asian-width_1.0.0_1698494653026_0.6852380542237115"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-28T12:04:13.231Z","publish_time":1698494653231,"_source_registry_name":"default","_cnpm_publish_time":1698494653231}},"readme":"# get-east-asian-width\n\n> Determine the [East Asian Width](https://unicode.org/reports/tr11/) of a Unicode character\n\n> East Asian Width categorizes Unicode characters based on their occupied space in East Asian typography, which helps in text layout and alignment, particularly in languages like Japanese, Chinese, and Korean.\n\nUnlike other similar packages, this package uses the latest Unicode data (which changes each year).\n\n## Install\n\n```sh\nnpm install get-east-asian-width\n```\n\n## Usage\n\n```js\nimport {eastAsianWidth, eastAsianWidthType} from 'get-east-asian-width';\n\nconst codePoint = '字'.codePointAt(0);\n\nconsole.log(eastAsianWidth(codePoint));\n//=> 2\n\nconsole.log(eastAsianWidthType(codePoint));\n//=> 'wide'\n```\n\n## `eastAsianWidth(codePoint: number, options?: object): 1 | 2`\n\nReturns the width as a number for the given code point.\n\n### options\n\nType: `object`\n\n#### ambiguousAsWide\n\nType: `boolean`\\\nDefault: `false`\n\nWhether to treat an `'ambiguous'` character as wide.\n\n```js\nimport {eastAsianWidth} from 'get-east-asian-width';\n\nconst codePoint = '⛣'.codePointAt(0);\n\nconsole.log(eastAsianWidth(codePoint));\n//=> 1\n\nconsole.log(eastAsianWidth(codePoint, {ambiguousAsWide: true}));\n//=> 2\n```\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## `eastAsianWidthType(codePoint: number): 'fullwidth' | 'halfwidth' | 'wide' | 'narrow' | 'neutral' | 'ambiguous'`\n\nReturns the type of “East Asian Width” for the given code point.\n\n## Related\n\n- [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string\n","_attachments":{},"homepage":"https://github.com/sindresorhus/get-east-asian-width#readme","bugs":{"url":"https://github.com/sindresorhus/get-east-asian-width/issues"},"license":"MIT"}