{"_id":"byte-length","_rev":"276558","name":"byte-length","description":"Get the real byte length of a string.","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"time":{"modified":"2021-06-03T18:03:01.000Z","created":"2015-10-03T04:35:33.932Z","1.0.2":"2017-10-17T00:46:45.816Z","1.0.1":"2017-10-15T00:42:27.673Z","1.0.0":"2017-10-15T00:07:42.586Z","0.1.1":"2015-12-18T04:11:01.701Z","0.1.0":"2015-10-03T04:35:33.932Z"},"users":{},"author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"versions":{"1.0.2":{"name":"byte-length","description":"Get the real byte length of a string.","version":"1.0.2","author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"devDependencies":{"@types/mocha":"^2.2.43","@types/node":"^8.0.34","coveralls":"^3.0.0","husky":"^0.14.3","lint-staged":"^4.2.3","mocha":"^4.0.1","nyc":"^11.2.1","prettier":"^1.7.4","ts-node":"^3.3.0","tslint":"^5.7.0","tslint-config-prettier":"^1.5.0","typescript":"^2.5.3"},"files":["dist"],"homepage":"https://github.com/DylanPiercey/byte-length","keywords":["bytes","content-length","length","string"],"license":"MIT","lint-staged":{"*.ts":["prettier --write","tslint -t codeFrame -c tslint.json","git add"]},"main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"scripts":{"build":"tsc","coveralls":"cat coverage/lcov.info | coveralls","format-all":"find {src,test} -name '*.ts' | xargs prettier --write","mocha":"mocha -r ts-node/register ./test/**/*.test.ts","precommit":"lint-staged && npm test && npm run build","test":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcov --reporter=text-summary npm run mocha","test-ci":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcovonly --reporter=text npm run mocha"},"types":"dist/index.d.ts","gitHead":"ac43901684c5abb621c2e92c8268c47394841cc9","_id":"byte-length@1.0.2","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"dylanpiercey","email":"pierceydylan@gmail.com"},"dist":{"shasum":"ba5a5909240b0121c079b7f7b15248d6f08223cc","size":2221,"noattachment":false,"key":"/byte-length/-/byte-length-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/byte-length/download/byte-length-1.0.2.tgz"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/byte-length-1.0.2.tgz_1508201205736_0.6627583813387901"},"directories":{},"publish_time":1508201205816,"_hasShrinkwrap":false,"_cnpm_publish_time":1508201205816},"1.0.1":{"name":"byte-length","description":"Get the real byte length of a string.","version":"1.0.1","author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"devDependencies":{"@types/mocha":"^2.2.43","@types/node":"^8.0.34","coveralls":"^3.0.0","husky":"^0.14.3","lint-staged":"^4.2.3","mocha":"^4.0.1","nyc":"^11.2.1","prettier":"^1.7.4","ts-node":"^3.3.0","tslint":"^5.7.0","tslint-config-prettier":"^1.5.0","typescript":"^2.5.3"},"files":["dist"],"homepage":"https://github.com/DylanPiercey/byte-length","keywords":["bytes","content-length","length","string"],"license":"MIT","lint-staged":{"*.ts":["prettier --write","tslint -t codeFrame -c tslint.json","git add"]},"main":"index.js","repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"scripts":{"build":"tsc","coveralls":"cat coverage/lcov.info | coveralls","format-all":"find {src,test} -name '*.ts' | xargs prettier --write","mocha":"mocha -r ts-node/register ./test/**/*.test.ts","precommit":"lint-staged && npm test && npm run build","test":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcov --reporter=text-summary npm run mocha","test-ci":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcovonly --reporter=text npm run mocha"},"types":"dist/index.d.ts","gitHead":"21bd5d3fc339579ef3a4d05ec7f5a1362e28df90","_id":"byte-length@1.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"dylanpiercey","email":"pierceydylan@gmail.com"},"dist":{"shasum":"79a494150c0765242d7eeb3423def9e02033f735","size":2219,"noattachment":false,"key":"/byte-length/-/byte-length-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/byte-length/download/byte-length-1.0.1.tgz"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/byte-length-1.0.1.tgz_1508028147575_0.8307609937619418"},"directories":{},"publish_time":1508028147673,"_hasShrinkwrap":false,"_cnpm_publish_time":1508028147673},"1.0.0":{"name":"byte-length","description":"Get the real byte length of a string.","version":"1.0.0","author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"devDependencies":{"@types/mocha":"^2.2.43","@types/node":"^8.0.34","coveralls":"^3.0.0","husky":"^0.14.3","lint-staged":"^4.2.3","mocha":"^4.0.1","nyc":"^11.2.1","prettier":"^1.7.4","ts-node":"^3.3.0","tslint":"^5.7.0","tslint-config-prettier":"^1.5.0","typescript":"^2.5.3"},"homepage":"https://github.com/DylanPiercey/byte-length","keywords":["bytes","content-length","length","string"],"license":"MIT","lint-staged":{"*.ts":["prettier --write","tslint -t codeFrame -c tslint.json","git add"]},"main":"index.js","repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"scripts":{"build":"tsc","coveralls":"cat coverage/lcov.info | coveralls","format-all":"find {src,test} -name '*.ts' | xargs prettier --write","mocha":"mocha -r ts-node/register ./test/**/*.test.ts","precommit":"lint-staged && npm test && npm run build","test":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcov --reporter=text-summary npm run mocha","test-ci":"nyc --extension=.ts --include=src/**/*.ts --reporter=lcovonly --reporter=text npm run mocha"},"types":"dist/index.d.ts","gitHead":"8a1d21cbde7baa6d42489bb9d8bffdb290b9896d","_id":"byte-length@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"dylanpiercey","email":"pierceydylan@gmail.com"},"dist":{"shasum":"8b6c3790660e7cb4b8d1c561f9e31533ed476e9c","size":2466,"noattachment":false,"key":"/byte-length/-/byte-length-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/byte-length/download/byte-length-1.0.0.tgz"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/byte-length-1.0.0.tgz_1508026062470_0.7059811560902745"},"directories":{},"publish_time":1508026062586,"_hasShrinkwrap":false,"_cnpm_publish_time":1508026062586},"0.1.1":{"name":"byte-length","version":"0.1.1","description":"Get the real byte length of a string.","author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"main":"index.js","license":"MIT","keywords":["bytes","string","length","content-length"],"repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"gitHead":"bbda0006b962d3888e95d06be5544e994db74153","bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"homepage":"https://github.com/DylanPiercey/byte-length#readme","_id":"byte-length@0.1.1","scripts":{},"_shasum":"e9b4774dbce7c59764bf5be87c302789a88738c3","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.2.0","_npmUser":{"name":"dylanpiercey","email":"pierceydylan@gmail.com"},"dist":{"shasum":"e9b4774dbce7c59764bf5be87c302789a88738c3","size":1124,"noattachment":false,"key":"/byte-length/-/byte-length-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/byte-length/download/byte-length-0.1.1.tgz"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"directories":{},"publish_time":1450411861701,"_cnpm_publish_time":1450411861701,"_hasShrinkwrap":false},"0.1.0":{"name":"byte-length","version":"0.1.0","description":"Get the real byte length of a string.","author":{"name":"Dylan Piercey","email":"pierceydylan@gmail.com"},"main":"index.js","license":"MIT","keywords":["bytes","string","length","content-length"],"repository":{"type":"git","url":"git+https://github.com/DylanPiercey/byte-length.git"},"bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"homepage":"https://github.com/DylanPiercey/byte-length#readme","_id":"byte-length@0.1.0","scripts":{},"_shasum":"70dfa14da772f5652ccc5a8e86af6bd4eb3e9b83","_from":".","_npmVersion":"2.14.3","_nodeVersion":"4.1.0","_npmUser":{"name":"dylanpiercey","email":"pierceydylan@gmail.com"},"dist":{"shasum":"70dfa14da772f5652ccc5a8e86af6bd4eb3e9b83","size":1101,"noattachment":false,"key":"/byte-length/-/byte-length-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/byte-length/download/byte-length-0.1.0.tgz"},"maintainers":[{"name":"dylanpiercey","email":"pierceydylan@gmail.com"}],"directories":{},"publish_time":1443846933932,"_cnpm_publish_time":1443846933932,"_hasShrinkwrap":false}},"readme":"<h1 align=\"center\">\n  <!-- Logo -->\n  <br/>\n  Byte-Length\n\t<br/>\n\n  <!-- Stability -->\n  <a href=\"https://nodejs.org/api/documentation.html#documentation_stability_index\">\n    <img src=\"https://img.shields.io/badge/stability-stable-brightgreen.svg\" alt=\"API Stability\"/>\n  </a>\n  <!-- TypeScript -->\n  <a href=\"http://typescriptlang.org\">\n    <img src=\"https://img.shields.io/badge/%3C%2F%3E-typescript-blue.svg\" alt=\"TypeScript\"/>\n  </a>\n  <!-- Prettier -->\n  <a href=\"https://github.com/prettier/prettier\">\n    <img src=\"https://img.shields.io/badge/styled_with-prettier-ff69b4.svg\" alt=\"Styled with prettier\"/>\n  </a>\n  <!-- Travis build -->\n  <a href=\"https://travis-ci.org/DylanPiercey/byte-length\">\n  <img src=\"https://img.shields.io/travis/DylanPiercey/byte-length.svg\" alt=\"Build status\"/>\n  </a>\n  <!-- Coveralls coverage -->\n  <a href=\"https://coveralls.io/github/DylanPiercey/byte-length\">\n    <img src=\"https://img.shields.io/coveralls/DylanPiercey/byte-length.svg\" alt=\"Test Coverage\"/>\n  </a>\n  <!-- NPM version -->\n  <a href=\"https://npmjs.org/package/byte-length\">\n    <img src=\"https://img.shields.io/npm/v/byte-length.svg\" alt=\"NPM Version\"/>\n  </a>\n  <!-- Downloads -->\n  <a href=\"https://npmjs.org/package/byte-length\">\n    <img src=\"https://img.shields.io/npm/dm/byte-length.svg\" alt=\"Downloads\"/>\n  </a>\n  <!-- Size -->\n  <a href=\"https://npmjs.org/package/byte-length\">\n    <img src=\"https://img.shields.io/badge/size-422b-green.svg\" alt=\"Browser Bundle Size\"/>\n  </a>\n</h1>\n\nCalculate the real byte length of any string.\n\n# Why\nIn node many will use `Buffer.byteLength`, however including the entire buffer shim in the browser just for getting the byte length of a string is not very conservative.\n\n# Installation\n\n```console\nnpm install byte-length\n```\n\n# Example\n\n```javascript\nimport { byteLength } from \"byte-length\";\n\nbyteLength(\"hello\"); //-> 5\nbyteLength(\"????\"); //-> 4\nbyteLength(\"ｆｕｌｌｗｉｄｔｈ　ｃｈａｒａｃｔｅｒｓ\"); //-> 60\n```\n\n### Contributions\n\n* Use `npm test` to run tests.\n\nPlease feel free to create a PR!\n","_attachments":{},"homepage":"https://github.com/DylanPiercey/byte-length","bugs":{"url":"https://github.com/DylanPiercey/byte-length/issues"},"license":"MIT"}