{"name":"fast-string-width","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/fast-string-width.git"},"description":"A fast function for calculating the visual width of a string once printed to the terminal.","license":"MIT","version":"3.0.2","type":"module","main":"dist/index.js","exports":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"tsex test","test:watch":"tsex test --watch","prepublishOnly":"tsex prepare"},"keywords":["fast","string","width","cli","terminal"],"dependencies":{"fast-string-truncated-width":"^3.0.2"},"devDependencies":{"fava":"^0.3.4","tsex":"^4.0.2","typescript":"^5.7.3"},"_id":"fast-string-width@3.0.2","gitHead":"f49e7b7662906e0028a68a16b5358500b2f3152d","bugs":{"url":"https://github.com/fabiospampinato/fast-string-width/issues"},"homepage":"https://github.com/fabiospampinato/fast-string-width#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==","shasum":"16dbabb491ce5585b5ecb675b65c165d71688eeb","tarball":"http://registry-npm.ywwl.com/fast-string-width/download/fast-string-width-3.0.2.tgz","fileCount":5,"unpackedSize":3515,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFYXHg1hrsnD4wkmvSM4Y4SvgZ2P+I2V8AZrIbVFFIoBAiAgfkc+2iTS4/G8UrkjDhAwplFU4+ylOcyeo8udErKbcQ=="}],"size":1805,"noattachment":false,"key":"/fast-string-width/-/fast-string-width-3.0.2.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fast-string-width_3.0.2_1759228265263_0.6078504013386254"},"_hasShrinkwrap":false,"readme":"# Fast String Width\n\nA fast function for calculating the visual width of a string once printed to the terminal.\n\nSee [`fast-string-truncated-width`](https://github.com/fabiospampinato/fast-string-truncated-width) for a lower-level version of this.\n\n## Install\n\n```sh\nnpm install fast-string-width\n```\n\n## Usage\n\n```ts\nimport fastStringWidth from 'fast-string-width';\n\n// The width of various classes of characters is configurable\n\nconst options = {\n  controlWidth: 0,\n  tabWidth: 8,\n  emojiWidth: 2,\n  regularWidth: 1,\n  wideWidth: 2\n};\n\n// Calculating the visual width of some strings\n\nfastStringWidth ( 'hello', options ); // => 5\nfastStringWidth ( '\\x1b[31mhello', options ); // => 5\nfastStringWidth ( '👨‍👩‍👧‍👦', options ); // => 2\nfastStringWidth ( 'hello👨‍👩‍👧‍👦', options ); // => 7\n\n// Calculating the visual width while tweaking the width of emojis\n\nfastStringWidth ( '👶👶🏽', { ...options, emojiWidth: 1.5 } ); // => 3\n```\n\n## License\n\nMIT © Fabio Spampinato\n","publish_time":1759228265462,"_cnpm_publish_time":1759228265462,"dist-tags":{"latest":"3.0.2"}}