{"_id":"typed-array-byte-length","_rev":"3745000","name":"typed-array-byte-length","description":"Robustly get the byte length of a Typed Array","dist-tags":{"latest":"1.0.3"},"maintainers":[{"name":"ljharb","email":""}],"time":{"modified":"2025-02-13T06:28:14.000Z","created":"2023-07-14T21:49:10.894Z","1.0.3":"2024-12-17T22:33:13.006Z","1.0.2":"2024-12-17T20:18:33.124Z","1.0.1":"2024-02-21T07:10:55.243Z","1.0.0":"2023-07-14T21:49:10.894Z"},"users":{},"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/inspect-js/typed-array-byte-length.git"},"versions":{"1.0.3":{"name":"typed-array-byte-length","version":"1.0.3","description":"Robustly get the byte length of a Typed Array","main":"index.js","exports":{".":"./index.js","./package.json":"./package.json"},"types":"./index.d.ts","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","postlint":"tsc -p . && attw -P","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"npx npm@'>= 10.2' audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/inspect-js/typed-array-byte-length.git"},"keywords":["typed","array","byteLength","byte","length","robust","es","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","dependencies":{"call-bind":"^1.0.8","for-each":"^0.3.3","gopd":"^1.2.0","has-proto":"^1.2.0","is-typed-array":"^1.1.14"},"devDependencies":{"@arethetypeswrong/cli":"^0.17.1","@ljharb/eslint-config":"^21.1.1","@ljharb/tsconfig":"^0.2.2","@types/call-bind":"^1.0.5","@types/for-each":"^0.3.3","@types/gopd":"^1.0.3","@types/is-callable":"^1.1.2","@types/make-arrow-function":"^1.2.2","@types/make-generator-function":"^2.0.3","@types/object-inspect":"^1.13.0","@types/tape":"^5.7.0","auto-changelog":"^2.5.0","available-typed-arrays":"^1.0.7","encoding":"^0.1.13","eslint":"=8.8.0","evalmd":"^0.0.19","in-publish":"^2.0.1","is-callable":"^1.2.7","make-arrow-function":"^1.2.0","make-generator-function":"^2.0.0","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","safe-publish-latest":"^2.0.0","tape":"^5.9.0","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"testling":{"files":"test/index.js"},"publishConfig":{"ignore":[".github/workflows"]},"_id":"typed-array-byte-length@1.0.3","gitHead":"e8e0b5b1625b45fca47eea2931f8b9185fa19da1","_nodeVersion":"23.4.0","_npmVersion":"10.9.2","dist":{"shasum":"8407a04f7d78684f3d252aa1a143d2b77b4160ce","size":6319,"noattachment":false,"key":"/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-array-byte-length/download/typed-array-byte-length-1.0.3.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/typed-array-byte-length_1.0.3_1734474792734_0.13722164026201256"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-12-17T22:33:13.006Z","publish_time":1734474793006,"_source_registry_name":"default","_cnpm_publish_time":1734474793006},"1.0.2":{"name":"typed-array-byte-length","version":"1.0.2","description":"Robustly get the byte length of a Typed Array","main":"index.js","exports":{".":"./index.js","./package.json":"./package.json"},"types":"./index.d.ts","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","postlint":"tsc -p . && attw -P","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"npx npm@'>= 10.2' audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/inspect-js/typed-array-byte-length.git"},"keywords":["typed","array","byteLength","byte","length","robust","es","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","dependencies":{"call-bind":"^1.0.8","for-each":"^0.3.3","gopd":"^1.2.0","has-proto":"^1.2.0","is-typed-array":"^1.1.14"},"devDependencies":{"@arethetypeswrong/cli":"^0.17.1","@ljharb/eslint-config":"^21.1.1","@ljharb/tsconfig":"^0.2.2","@types/call-bind":"^1.0.5","@types/for-each":"^0.3.3","@types/gopd":"^1.0.3","@types/is-callable":"^1.1.2","@types/make-arrow-function":"^1.2.2","@types/make-generator-function":"^2.0.3","@types/object-inspect":"^1.13.0","@types/tape":"^5.7.0","auto-changelog":"^2.5.0","available-typed-arrays":"^1.0.7","encoding":"^0.1.13","eslint":"=8.8.0","evalmd":"^0.0.19","in-publish":"^2.0.1","is-callable":"^1.2.7","make-arrow-function":"^1.2.0","make-generator-function":"^2.0.0","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","safe-publish-latest":"^2.0.0","tape":"^5.9.0","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"testling":{"files":"test/index.js"},"publishConfig":{"ignore":[".github/workflows"]},"_id":"typed-array-byte-length@1.0.2","gitHead":"713940c84f35d6125998a058fd2f23be4b1b43f4","_nodeVersion":"23.4.0","_npmVersion":"10.9.2","dist":{"shasum":"6e30b672a4192fdb7476c3b2191b860c62129434","size":6248,"noattachment":false,"key":"/typed-array-byte-length/-/typed-array-byte-length-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-array-byte-length/download/typed-array-byte-length-1.0.2.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/typed-array-byte-length_1.0.2_1734466712890_0.3479111119945264"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-12-17T20:18:33.124Z","publish_time":1734466713124,"_source_registry_name":"default","_cnpm_publish_time":1734466713124},"1.0.1":{"name":"typed-array-byte-length","version":"1.0.1","description":"Robustly get the byte length of a Typed Array","main":"index.js","exports":{".":"./index.js","./package.json":"./package.json"},"types":"./index.d.ts","sideEffects":false,"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","postlint":"tsc -p .","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"aud --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/inspect-js/typed-array-byte-length.git"},"keywords":["typed","array","byteLength","byte","length","robust","es","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","dependencies":{"call-bind":"^1.0.7","for-each":"^0.3.3","gopd":"^1.0.1","has-proto":"^1.0.3","is-typed-array":"^1.1.13"},"devDependencies":{"@ljharb/eslint-config":"^21.1.0","@types/call-bind":"^1.0.5","@types/for-each":"^0.3.3","@types/gopd":"^1.0.3","@types/is-callable":"^1.1.2","@types/make-arrow-function":"^1.2.2","@types/make-generator-function":"^2.0.3","@types/object-inspect":"^1.8.4","@types/tape":"^5.6.4","aud":"^2.0.4","auto-changelog":"^2.4.0","available-typed-arrays":"^1.0.7","eslint":"=8.8.0","evalmd":"^0.0.19","in-publish":"^2.0.1","is-callable":"^1.2.7","make-arrow-function":"^1.2.0","make-generator-function":"^2.0.0","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.1","safe-publish-latest":"^2.0.0","tape":"^5.7.5","typescript":"next"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"testling":{"files":"test/index.js"},"publishConfig":{"ignore":[".github/workflows"]},"_id":"typed-array-byte-length@1.0.1","gitHead":"e0b419e4f31079c8847ba85dad078e587a18973f","_nodeVersion":"21.6.2","_npmVersion":"10.2.4","dist":{"shasum":"d92972d3cff99a3fa2e765a28fcdc0f1d89dec67","size":6850,"noattachment":false,"key":"/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-array-byte-length/download/typed-array-byte-length-1.0.1.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-array-byte-length_1.0.1_1708499455091_0.16769186878462072"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-21T07:10:55.243Z","publish_time":1708499455243,"_source_registry_name":"default","_cnpm_publish_time":1708499455243},"1.0.0":{"name":"typed-array-byte-length","version":"1.0.0","description":"Robustly get the byte length of a Typed Array","main":"index.js","exports":{".":"./index.js","./package.json":"./package.json"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run lint","prelint":"evalmd README.md","lint":"eslint --ext=js,mjs .","tests-only":"nyc tape 'test/**/*.js'","test":"npm run tests-only","posttest":"aud --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git+https://github.com/inspect-js/typed-array-byte-length.git"},"keywords":["typed","array","byteLength","byte","length","robust","es","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"license":"MIT","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","dependencies":{"call-bind":"^1.0.2","for-each":"^0.3.3","has-proto":"^1.0.1","is-typed-array":"^1.1.10"},"devDependencies":{"@ljharb/eslint-config":"^21.1.0","aud":"^2.0.2","auto-changelog":"^2.4.0","available-typed-arrays":"^1.0.5","eslint":"=8.8.0","evalmd":"^0.0.19","in-publish":"^2.0.1","is-callable":"^1.2.7","make-arrow-function":"^1.2.0","make-generator-function":"^2.0.0","npmignore":"^0.3.0","nyc":"^10.3.2","object-inspect":"^1.12.3","safe-publish-latest":"^2.0.0","tape":"^5.6.3"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"testling":{"files":"test/index.js"},"publishConfig":{"ignore":[".github/workflows"]},"gitHead":"8298313986fa9b614e8e4b6da0b4fb0279b18a8e","_id":"typed-array-byte-length@1.0.0","_nodeVersion":"20.4.0","_npmVersion":"9.7.2","dist":{"shasum":"d787a24a995711611fb2b87a4052799517b230d0","size":4720,"noattachment":false,"key":"/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/typed-array-byte-length/download/typed-array-byte-length-1.0.0.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typed-array-byte-length_1.0.0_1689371350740_0.7969543909046957"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-07-14T21:49:10.894Z","publish_time":1689371350894,"_source_registry_name":"default","_cnpm_publish_time":1689371350894}},"readme":"# typed-array-byte-offset <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nRobustly get the byte offset of a Typed Array, or `false` if it is not a Typed Array. Works cross-realm, in every engine, even if the `byteOffset` property is overridden.\n\n## Example\n\n```js\nvar typedArrayByteOffset = require('typed-array-byte-offset');\nvar assert = require('assert');\n\nassert.equal(false, typedArrayByteOffset(undefined));\nassert.equal(false, typedArrayByteOffset(null));\nassert.equal(false, typedArrayByteOffset(false));\nassert.equal(false, typedArrayByteOffset(true));\nassert.equal(false, typedArrayByteOffset([]));\nassert.equal(false, typedArrayByteOffset({}));\nassert.equal(false, typedArrayByteOffset(/a/g));\nassert.equal(false, typedArrayByteOffset(new RegExp('a', 'g')));\nassert.equal(false, typedArrayByteOffset(new Date()));\nassert.equal(false, typedArrayByteOffset(42));\nassert.equal(false, typedArrayByteOffset(NaN));\nassert.equal(false, typedArrayByteOffset(Infinity));\nassert.equal(false, typedArrayByteOffset(new Number(42)));\nassert.equal(false, typedArrayByteOffset('foo'));\nassert.equal(false, typedArrayByteOffset(Object('foo')));\nassert.equal(false, typedArrayByteOffset(function () {}));\nassert.equal(false, typedArrayByteOffset(function* () {}));\nassert.equal(false, typedArrayByteOffset(x => x * x));\nassert.equal(false, typedArrayByteOffset([]));\n\nconst buffer = new ArrayBuffer(32);\n\nassert.equal(8, typedArrayByteOffset(new Int8Array(buffer, 8)));\nassert.equal(8, typedArrayByteOffset(new Uint8Array(buffer, 8)));\nassert.equal(8, typedArrayByteOffset(new Uint8ClampedArray(buffer, 8)));\nassert.equal(4, typedArrayByteOffset(new Int16Array(buffer, 4)));\nassert.equal(4, typedArrayByteOffset(new Uint16Array(buffer, 4)));\nassert.equal(8, typedArrayByteOffset(new Int32Array(buffer, 8)));\nassert.equal(8, typedArrayByteOffset(new Uint32Array(buffer, 8)));\nassert.equal(16, typedArrayByteOffset(new Float32Array(buffer, 16)));\nassert.equal(16, typedArrayByteOffset(new Float64Array(buffer, 16)));\nassert.equal(16, typedArrayByteOffset(new BigInt64Array(buffer, 16)));\nassert.equal(16, typedArrayByteOffset(new BigUint64Array(buffer, 16)));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/typed-array-byte-offset\n[npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-byte-offset.svg\n[deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset.svg\n[deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset\n[dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-byte-offset/dev-status.svg\n[dev-deps-url]: https://david-dm.org/inspect-js/typed-array-byte-offset#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/typed-array-byte-offset.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/typed-array-byte-offset.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/typed-array-byte-offset.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=typed-array-byte-offset\n[codecov-image]: https://codecov.io/gh/inspect-js/typed-array-byte-offset/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-byte-offset/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-byte-offset\n[actions-url]: https://github.com/inspect-js/typed-array-byte-offset/actions\n","_attachments":{},"homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"license":"MIT"}