{"_id":"wcsize","_rev":"3-1e2edf197b160843a9588dcc2487ca51","name":"wcsize","description":"Derived from visualwidth-js this package identifies the size of one characterCode in terminals","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"wcsize","version":"1.0.0","description":"Derived from visualwidth-js this package identifies the size of one characterCode in terminals","main":"index.js","scripts":{"test":"tape test/**/*.js; standard"},"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"keywords":["unicode","visualwidth","terminal","wide character","wc","wide character string","wcs","terminal","width","wcwidth","wcswidth"],"license":"ISC","dependencies":{},"devDependencies":{"standard":"^5.3.1","tape":"^4.2.2"},"directories":{"test":"test"},"repository":{"type":"git","url":"git+https://github.com/martinheidegger/wcsize.git"},"bugs":{"url":"https://github.com/martinheidegger/wcsize/issues"},"homepage":"https://github.com/martinheidegger/wcsize#readme","gitHead":"a9cb0dd3d88ad1bb3bddc9ea3a93f562a74ada55","_id":"wcsize@1.0.0","_shasum":"a8a2e15e6a8a74791dba580f69a57d27e850ea1e","_from":".","_npmVersion":"3.3.9","_nodeVersion":"4.2.1","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"a8a2e15e6a8a74791dba580f69a57d27e850ea1e","tarball":"https://registry.npmjs.org/wcsize/-/wcsize-1.0.0.tgz","integrity":"sha512-80ziCk3Z+iLfhgAbMBMU+PjoSFi9dg0FIKYd9xRiF15wfwJlzxu1mdIUdIv9iE1gpkX/4hV2QBbkNlydXgEFMA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHLZ1P9mEwu4fru2HZJBP5NybaHgEq0VjFTOU7V3eyWfAiEAg6GsJ5pz/tDPAZdIIOEYxxNk64HXxtLLezP/xFjTWGk="}]}}},"readme":"[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg?style=flat)](LICENSE.md)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)\n[![npm version](https://badge.fury.io/js/wcsize.svg)](https://badge.fury.io/js/wcsize)\n\n# wcsize\n`wcsize` is a JavaScript CommonJS package that deals with the fact that some characters in monospace font environments (like terminals) are displayed with the size of two characters while others occupy the space of one character.\n\nIt is derived (forked) from [wcwidth](https://github.com/timoxley/wcwidth) which is a derivate of [wcwidth.c](http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c) which is custom implemented and seems better tested with japanese than the similar package [visualwidth-js](https://github.com/tokuhirom/visualwidth-js). It differes from both of those packages by only returning the width of one character (as integer!) which is important for performance\nreasons.\n\nThis is a sister-package of [monospace-char-width](https://github.com/martinheidegger/monospace-char-width) whis is based on `visualwidth-js`.\n\n## Installation & Usage\nInstall the package with `npm i wcsize --save` and pass the character you want to test like this:\n\n```JavaScript\nvar wcsize = require('wcsize')\n\nfunction charSize(string, pos) {\n    wcsize(string.charCodeAt(pos), pos > 0 ? string.charCodeAt(pos-1) : 0)\n}\n\ncharSize('abcd', 0) // 1\n```\n\n## Surrogates _or_ Why two character codes?\nThe size of some characters depends on surrogates which means that depending on the character before their size changes. For it to work appropriately you need to pass-in both the current character code and the one before that.\n\n","maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"time":{"modified":"2022-06-28T22:23:02.720Z","created":"2015-10-31T18:35:51.669Z","1.0.0":"2015-10-31T18:35:51.669Z"},"homepage":"https://github.com/martinheidegger/wcsize#readme","keywords":["unicode","visualwidth","terminal","wide character","wc","wide character string","wcs","terminal","width","wcwidth","wcswidth"],"repository":{"type":"git","url":"git+https://github.com/martinheidegger/wcsize.git"},"author":{"name":"Martin Heidegger","email":"martin.heidegger@gmail.com"},"bugs":{"url":"https://github.com/martinheidegger/wcsize/issues"},"license":"ISC","readmeFilename":"Readme.md"}