{ "name": "string-width", "description": "Get the visual width of a string - the number of columns required to display it", "dist-tags": { "latest": "5.1.2", "version4": "4.2.3" }, "versions": { "2.1.1": { "name": "string-width", "version": "2.1.1", "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" }, "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" }, "devDependencies": { "ava": "*", "xo": "*" }, "gitHead": "74d8d552b465692790c41169b123409669d41079", "bugs": { "url": "https://github.com/sindresorhus/string-width/issues" }, "_id": "string-width@2.1.1", "_npmVersion": "5.0.0", "_nodeVersion": "8.0.0", "dist": { "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "shasum": "ab93f27a8dc13d28cac815c462143a6d9012ae9e", "tarball": "http://localhost:4260/string-width/string-width-2.1.1.tgz" }, "directories": {} }, "4.2.3": { "name": "string-width", "version": "4.2.3", "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" }, "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" }, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" }, "devDependencies": { "ava": "^1.4.1", "tsd": "^0.7.1", "xo": "^0.24.0" }, "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 doesn't affect the width.\n\nUseful to be able to measure the actual width of command-line output.\n\n\n## Install\n\n```\n$ npm install string-width\n```\n\n\n## Usage\n\n```js\nconst stringWidth = require('string-width');\n\nstringWidth('a');\n//=> 1\n\nstringWidth('古');\n//=> 2\n\nstringWidth('\\u001B[1m古\\u001B[22m');\n//=> 2\n```\n\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\n\n---\n\n
\n\t\n\t\tGet professional support for this package with a Tidelift subscription\n\t\n\t
\n\t\n\t\tTidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.\n\t
\n
\n", "readmeFilename": "readme.md", "gitHead": "e7a2755c834246c59a4cc5de9471bef2d531a6b1", "bugs": { "url": "https://github.com/sindresorhus/string-width/issues" }, "_id": "string-width@4.2.3", "_nodeVersion": "16.9.1", "_npmVersion": "7.5.4", "dist": { "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "shasum": "269c7117d27b05ad2e536830a8ec895ef9c6d010", "tarball": "http://localhost:4260/string-width/string-width-4.2.3.tgz", "fileCount": 5, "unpackedSize": 5161 }, "directories": {}, "_hasShrinkwrap": false }, "5.1.2": { "name": "string-width", "version": "5.1.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": "./index.js", "engines": { "node": ">=12" }, "scripts": { "test": "xo && ava && tsd" }, "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" }, "devDependencies": { "ava": "^3.15.0", "tsd": "^0.14.0", "xo": "^0.38.2" }, "types": "./index.d.ts", "gitHead": "9f90691968ad356c807aaad1a5ed98d795749932", "bugs": { "url": "https://github.com/sindresorhus/string-width/issues" }, "_id": "string-width@5.1.2", "_nodeVersion": "12.22.1", "_npmVersion": "8.3.2", "dist": { "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "shasum": "14f8daec6d81e7221d2a357e668cab73bdbca794", "tarball": "http://localhost:4260/string-width/string-width-5.1.2.tgz", "fileCount": 5, "unpackedSize": 5781 }, "directories": {}, "_hasShrinkwrap": false } }, "homepage": "https://github.com/sindresorhus/string-width#readme", "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/string-width.git" }, "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/string-width/issues" }, "license": "MIT", "readmeFilename": "readme.md" }