{"_id":"widest-line","_rev":"4125094","name":"widest-line","description":"Get the visual width of the widest line in a string - the number of columns required to display it","dist-tags":{"latest":"6.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-02-27T18:34:32.000Z","created":"2015-11-04T11:31:15.944Z","6.0.0":"2026-01-24T03:25:03.834Z","5.0.0":"2023-10-28T17:19:52.392Z","4.0.1":"2021-10-12T07:29:37.915Z","4.0.0":"2021-04-21T10:42:36.936Z","3.1.0":"2019-03-31T12:15:36.826Z","3.0.0":"2019-03-18T08:35:16.856Z","2.0.1":"2018-10-16T18:12:52.795Z","2.0.0":"2017-11-30T20:52:29.986Z","1.0.0":"2015-11-04T11:31:15.944Z"},"users":{"scottfreecode":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"versions":{"6.0.0":{"name":"widest-line","version":"6.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.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"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^8.1.0"},"devDependencies":{"ava":"^6.4.1","xo":"^1.2.3"},"gitHead":"d1f04193564d484ca6e24fd8d78d96545ccb0a83","types":"./index.d.ts","_id":"widest-line@6.0.0","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_nodeVersion":"25.3.0","_npmVersion":"11.7.0","dist":{"shasum":"6a8638af837059501d61c5d3bdf72cb934f6c792","size":1768,"noattachment":false,"key":"/widest-line/-/widest-line-6.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-6.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/widest-line_6.0.0_1769225103684_0.6521352725312974"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-01-24T03:25:03.834Z","publish_time":1769225103834,"_source_registry_name":"default","_cnpm_publish_time":1769225103834},"5.0.0":{"name":"widest-line","version":"5.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.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 && tsd"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^7.0.0"},"devDependencies":{"ava":"^5.3.1","tsd":"^0.29.0","xo":"^0.56.0"},"types":"./index.d.ts","gitHead":"7561d2ccece1e5d880120a93cfdfb1b7fa63eeab","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@5.0.0","_nodeVersion":"18.18.2","_npmVersion":"9.2.0","dist":{"shasum":"b74826a1e480783345f0cd9061b49753c9da70d0","size":1770,"noattachment":false,"key":"/widest-line/-/widest-line-5.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_5.0.0_1698513592104_0.7027349395439526"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-28T17:19:52.392Z","publish_time":1698513592392,"_source_registry_name":"default","_cnpm_publish_time":1698513592392},"4.0.1":{"name":"widest-line","version":"4.0.1","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^5.0.1"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.39.1"},"gitHead":"5a9b9a9d328cb20fee45823a13538eef8a976289","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@4.0.1","_nodeVersion":"14.17.5","_npmVersion":"7.20.3","dist":{"shasum":"a0fc673aaba1ea6f0a0d35b3c2795c9a9cc2ebf2","size":1747,"noattachment":false,"key":"/widest-line/-/widest-line-4.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-4.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_4.0.1_1634023777773_0.6243834298441386"},"_hasShrinkwrap":false,"publish_time":1634023777915,"_cnpm_publish_time":1634023777915},"4.0.0":{"name":"widest-line","version":"4.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^5.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.39.1"},"gitHead":"f81355cea22a4f4080258d802a81c6669c30c765","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@4.0.0","_nodeVersion":"12.22.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"4b19a5da2b5c4f93704f34539395a0f4615da9ea","size":1769,"noattachment":false,"key":"/widest-line/-/widest-line-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-4.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_4.0.0_1619001756789_0.7917604601234498"},"_hasShrinkwrap":false,"publish_time":1619001756936,"_cnpm_publish_time":1619001756936},"3.1.0":{"name":"widest-line","version":"3.1.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^4.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.1","xo":"^0.24.0"},"gitHead":"694ebd1a633abfc4048a250b57e6c17d8531350b","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@3.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"8292333bbf66cb45ff0de1603b136b7ae1496eca","size":1917,"noattachment":false,"key":"/widest-line/-/widest-line-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-3.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_3.1.0_1554034536536_0.28938338585391277"},"_hasShrinkwrap":false,"publish_time":1554034536826,"_cnpm_publish_time":1554034536826},"3.0.0":{"name":"widest-line","version":"3.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["string","character","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^4.0.0"},"devDependencies":{"ava":"^1.3.1","tsd-check":"^0.5.0","xo":"^0.24.0"},"gitHead":"7d5a88fc022524bd4593d8a4b143e16823125219","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@3.0.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"3cc9ab65c4d0382cf05909900f9aa50328eba947","size":1850,"noattachment":false,"key":"/widest-line/-/widest-line-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_3.0.0_1552898116695_0.8710302790281419"},"_hasShrinkwrap":false,"publish_time":1552898116856,"_cnpm_publish_time":1552898116856},"2.0.1":{"name":"widest-line","version":"2.0.1","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"keywords":["string","str","character","char","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^2.1.1"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"11fc92452ad77233a53cec179202a6c68e2b8ad3","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@2.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"7438764730ec7ef4381ce4df82fb98a53142a3fc","size":1709,"noattachment":false,"key":"/widest-line/-/widest-line-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-2.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line_2.0.1_1539713572686_0.18572373483175264"},"_hasShrinkwrap":false,"publish_time":1539713572795,"_cnpm_publish_time":1539713572795},"2.0.0":{"name":"widest-line","version":"2.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/widest-line.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["string","str","character","char","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^2.1.1"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"af57e1e5eb6b7d8542eac408c64b7c34207d0d7e","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line#readme","_id":"widest-line@2.0.0","_shasum":"0142a4e8a243f8882c0233aa0e0281aa76152273","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"0142a4e8a243f8882c0233aa0e0281aa76152273","size":1711,"noattachment":false,"key":"/widest-line/-/widest-line-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/widest-line-2.0.0.tgz_1512075148854_0.25011543300934136"},"directories":{},"publish_time":1512075149986,"_hasShrinkwrap":false,"_cnpm_publish_time":1512075149986},"1.0.0":{"name":"widest-line","version":"1.0.0","description":"Get the visual width of the widest line in a string - the number of columns required to display it","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/widest-line"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["string","str","character","char","unicode","width","visual","column","columns","fullwidth","full-width","full","ansi","escape","codes","cli","command-line","terminal","console","cjk","chinese","japanese","korean","fixed-width"],"dependencies":{"string-width":"^1.0.1"},"devDependencies":{"ava":"*","xo":"*"},"gitHead":"8193ed602f6c06939099e574b92828edb896bb8e","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"homepage":"https://github.com/sindresorhus/widest-line","_id":"widest-line@1.0.0","_shasum":"0c09c85c2a94683d0d7eaf8ee097d564bf0e105c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"0c09c85c2a94683d0d7eaf8ee097d564bf0e105c","size":1767,"noattachment":false,"key":"/widest-line/-/widest-line-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/widest-line/download/widest-line-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1446636675944,"_cnpm_publish_time":1446636675944,"_hasShrinkwrap":false}},"readme":"# widest-line\n\n> Get the visual width of the widest line in 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](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.\n\nUseful to be able to know the maximum width a string will take up in the terminal.\n\n## Install\n\n```sh\nnpm install widest-line\n```\n\n## Usage\n\n```js\nimport widestLine from 'widest-line';\n\nwidestLine('古\\n\\u001B[1m@\\u001B[22m');\n//=> 2\n```\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/widest-line#readme","bugs":{"url":"https://github.com/sindresorhus/widest-line/issues"},"license":"MIT"}