{"name":"typed-array-byte-length","version":"1.0.2","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"},"license":"MIT","_id":"typed-array-byte-length@1.0.2","homepage":"https://github.com/inspect-js/typed-array-byte-length#readme","bugs":{"url":"https://github.com/inspect-js/typed-array-byte-length/issues"},"dist":{"shasum":"6e30b672a4192fdb7476c3b2191b860c62129434","tarball":"http://registry-npm.ywwl.com/typed-array-byte-length/download/typed-array-byte-length-1.0.2.tgz","fileCount":11,"integrity":"sha512-adiFrvWBKqevPpbl+LErGnoS7juikX0VLSK+s4rcUEqAv2gClx0DB/g0gMUQXMZiG2RhUDUFgQpyXta4AKG9VA==","signatures":[{"sig":"MEUCIQChcL/OQnm7ol/T7uxL3HGJ90XqcrFG5z84jrFva4feSgIgehI9CzDEM8BoBmOWA7O8oyPcVpxoqTpBDLi48MQO4bk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18146,"size":6248,"noattachment":false,"key":"/typed-array-byte-length/-/typed-array-byte-length-1.0.2.tgz"},"main":"index.js","types":"./index.d.ts","engines":{"node":">= 0.4"},"exports":{".":"./index.js","./package.json":"./package.json"},"funding":{"url":"https://github.com/sponsors/ljharb"},"gitHead":"713940c84f35d6125998a058fd2f23be4b1b43f4","scripts":{"lint":"eslint --ext=js,mjs .","test":"npm run tests-only","prelint":"evalmd README.md","prepack":"npmignore --auto --commentLines=autogenerated","pretest":"npm run lint","version":"auto-changelog && git add CHANGELOG.md","postlint":"tsc -p . && attw -P","posttest":"npx npm@'>= 10.2' audit --production","prepublish":"not-in-publish || npm run prepublishOnly","tests-only":"nyc tape 'test/**/*.js'","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"","prepublishOnly":"safe-publish-latest"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"testling":{"files":"test/index.js"},"repository":{"url":"git+https://github.com/inspect-js/typed-array-byte-length.git","type":"git"},"_npmVersion":"10.9.2","description":"Robustly get the byte length of a Typed Array","directories":{},"sideEffects":false,"_nodeVersion":"23.4.0","dependencies":{"gopd":"^1.2.0","for-each":"^0.3.3","call-bind":"^1.0.8","has-proto":"^1.2.0","is-typed-array":"^1.1.14"},"publishConfig":{"ignore":[".github/workflows"]},"_hasShrinkwrap":false,"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","hideCredit":true,"unreleased":false,"commitLimit":false,"backfillLimit":false},"devDependencies":{"nyc":"^10.3.2","tape":"^5.9.0","eslint":"=8.8.0","evalmd":"^0.0.19","encoding":"^0.1.13","npmignore":"^0.3.1","in-publish":"^2.0.1","typescript":"next","@types/gopd":"^1.0.3","@types/tape":"^5.7.0","is-callable":"^1.2.7","auto-changelog":"^2.5.0","object-inspect":"^1.13.3","@types/for-each":"^0.3.3","@ljharb/tsconfig":"^0.2.2","@types/call-bind":"^1.0.5","@types/is-callable":"^1.1.2","make-arrow-function":"^1.2.0","safe-publish-latest":"^2.0.0","@arethetypeswrong/cli":"^0.17.1","@ljharb/eslint-config":"^21.1.1","@types/object-inspect":"^1.13.0","available-typed-arrays":"^1.0.7","make-generator-function":"^2.0.0","@types/make-arrow-function":"^1.2.2","@types/make-generator-function":"^2.0.3"},"_npmOperationalInternal":{"tmp":"tmp/typed-array-byte-length_1.0.2_1734466712890_0.3479111119945264","host":"s3://npm-registry-packages-npm-production"},"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","publish_time":1734466713124,"maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"}],"_cnpm_publish_time":1734466713124,"dist-tags":{"latest":"1.0.3"}}