pax_global_header00006660000000000000000000000064147305736550014531gustar00rootroot0000000000000052 comment=348782b05f29ff3d7a4d947a56fc02c2d87fd83a inspect-js-typed-array-buffer-a4141b6/000077500000000000000000000000001473057365500176425ustar00rootroot00000000000000inspect-js-typed-array-buffer-a4141b6/.eslintrc000066400000000000000000000002201473057365500214600ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "new-cap": ["error", { "capIsNewExceptions": [ "GetIntrinsic", ], }], }, } inspect-js-typed-array-buffer-a4141b6/.github/000077500000000000000000000000001473057365500212025ustar00rootroot00000000000000inspect-js-typed-array-buffer-a4141b6/.github/FUNDING.yml000066400000000000000000000010641473057365500230200ustar00rootroot00000000000000# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/typed-array-buffer community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with a single custom sponsorship URL inspect-js-typed-array-buffer-a4141b6/.github/workflows/000077500000000000000000000000001473057365500232375ustar00rootroot00000000000000inspect-js-typed-array-buffer-a4141b6/.github/workflows/node-aught.yml000066400000000000000000000005551473057365500260220ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '< 10' type: minors command: npm run tests-only node: name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' inspect-js-typed-array-buffer-a4141b6/.github/workflows/node-pretest.yml000066400000000000000000000002451473057365500263740ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main inspect-js-typed-array-buffer-a4141b6/.github/workflows/node-tens.yml000066400000000000000000000005471473057365500256640ustar00rootroot00000000000000name: 'Tests: node.js 10 - 20' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10 < 20' type: minors command: npm run tests-only node: name: 'node 10 - 20' needs: [tests] runs-on: ubuntu-latest steps: - run: true inspect-js-typed-array-buffer-a4141b6/.github/workflows/node-twenties.yml000066400000000000000000000005361473057365500265530ustar00rootroot00000000000000name: 'Tests: node.js >= 20' on: [pull_request, push] permissions: contents: read jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 20' type: minors command: npm run tests-only node: name: 'node >= 20' needs: [tests] runs-on: ubuntu-latest steps: - run: true inspect-js-typed-array-buffer-a4141b6/.github/workflows/rebase.yml000066400000000000000000000007001473057365500252200ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] permissions: contents: read jobs: _: permissions: contents: write # for ljharb/rebase to push code to rebase pull-requests: read # for ljharb/rebase to get info about PR name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} inspect-js-typed-array-buffer-a4141b6/.github/workflows/require-allow-edits.yml000066400000000000000000000005151473057365500276610ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] permissions: contents: read jobs: _: permissions: pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main inspect-js-typed-array-buffer-a4141b6/.gitignore000066400000000000000000000041361473057365500216360ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional stylelint cache .stylelintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variable files .env .env.development.local .env.test.local .env.production.local .env.local # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # vuepress v2.x temp and cache directory .temp .cache # Docusaurus cache and generated files .docusaurus # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.* # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore inspect-js-typed-array-buffer-a4141b6/.npmrc000066400000000000000000000000671473057365500207650ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s inspect-js-typed-array-buffer-a4141b6/.nycrc000066400000000000000000000003301473057365500207550ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "lines": 86, "statements": 85.93, "functions": 82.43, "branches": 76.06, "exclude": [ "coverage", "test" ] } inspect-js-typed-array-buffer-a4141b6/CHANGELOG.md000066400000000000000000000102731473057365500214560ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v1.0.3](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.2...v1.0.3) - 2024-12-18 ### Commits - [meta] update URLs [`aca9484`](https://github.com/inspect-js/typed-array-buffer/commit/aca9484b41f96767408e26e63854b5d86f759de8) - [types] use shared config [`fcdcb05`](https://github.com/inspect-js/typed-array-buffer/commit/fcdcb05941a771826e1478a77aadd89c582e37cd) - [actions] split out node 10-20, and 20+ [`5f5a406`](https://github.com/inspect-js/typed-array-buffer/commit/5f5a4067752d7bccecbaa8f6e143863d55197af9) - [types] improve types [`f45042c`](https://github.com/inspect-js/typed-array-buffer/commit/f45042c07c04007217404d73aa77c26a73885210) - [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`0c937e7`](https://github.com/inspect-js/typed-array-buffer/commit/0c937e72e93dccc359c08cf1a9ef060e5f5e1a8d) - [Refactor] use `call-bound` directly [`cf4aba4`](https://github.com/inspect-js/typed-array-buffer/commit/cf4aba4d8c1702ee9130abaf8a6a72907ca96ce0) - [Tests] replace `aud` with `npm audit` [`a3abb73`](https://github.com/inspect-js/typed-array-buffer/commit/a3abb739300d1de6e88736019d718d831c7a4cca) - [Dev Deps] update `@types/tape` [`548ffdc`](https://github.com/inspect-js/typed-array-buffer/commit/548ffdc881726b060ac92fc0c59ab0bb150df91f) - [Deps] update `is-typed-array` [`3b5deb1`](https://github.com/inspect-js/typed-array-buffer/commit/3b5deb191a1c942deced0273b07fe69bc8de39ab) - [Deps] update `call-bind` [`02cbc0c`](https://github.com/inspect-js/typed-array-buffer/commit/02cbc0cca2f69d81cdeedf7beebae2a5dd9dd4f7) - [Tests] add attw and `postlint` [`f6daa66`](https://github.com/inspect-js/typed-array-buffer/commit/f6daa6695a69878d845070b90ab0bbf6392ebb03) - [Dev Deps] add missing peer dep [`c9faf2a`](https://github.com/inspect-js/typed-array-buffer/commit/c9faf2ac04fc78410aeb144405db110fe9b60b6c) ## [v1.0.2](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.1...v1.0.2) - 2024-02-19 ### Commits - add types [`23c6fba`](https://github.com/inspect-js/typed-array-buffer/commit/23c6fba167dbc8c1e9291eed3f68e64a5651075a) - [Deps] update `available-typed-arrays` [`5f68ba1`](https://github.com/inspect-js/typed-array-buffer/commit/5f68ba1fdcd004af46d529fbb08220de2254cf43) - [Deps] update `call-bind` [`54a92ce`](https://github.com/inspect-js/typed-array-buffer/commit/54a92ce4caf023c8680ffe64534ba881b78cdc17) - [Dev Deps] update `tape` [`b0b3342`](https://github.com/inspect-js/typed-array-buffer/commit/b0b3342bcbefae5f3dff01b0e3734b08ca927f58) ## [v1.0.1](https://github.com/inspect-js/typed-array-buffer/compare/v1.0.0...v1.0.1) - 2024-02-06 ### Commits - [Dev Deps] update `aud`, `available-typed-arrays`, `npmignore`, `object-inspect`, `tape` [`5334477`](https://github.com/inspect-js/typed-array-buffer/commit/53344773866f35820dc4deef1aa47ec7890f2b02) - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`e2511e0`](https://github.com/inspect-js/typed-array-buffer/commit/e2511e011a2331bd4a36ad6003a98b1cf766bc26) - [Deps] update `call-bind`, `get-intrinsic`, `is-typed-array` [`36c3b11`](https://github.com/inspect-js/typed-array-buffer/commit/36c3b11efc9bce98de8bee5f81dcae4305876893) - [meta] add `sideEffects` flag [`46cc1f4`](https://github.com/inspect-js/typed-array-buffer/commit/46cc1f4a8b8875fc6e84b33182602ec37655bbbd) ## v1.0.0 - 2023-06-05 ### Commits - Initial implementation, tests, readme [`5bc2953`](https://github.com/inspect-js/typed-array-buffer/commit/5bc295337b4310659832fc08699a4d10c2dbbded) - Initial commit [`98b8ac9`](https://github.com/inspect-js/typed-array-buffer/commit/98b8ac90f407c368effa25d395aeea1d72e1d4b6) - npm init [`6a4a73c`](https://github.com/inspect-js/typed-array-buffer/commit/6a4a73c66b1f13fd17699c6500a4979003676696) - Only apps should have lockfiles [`7226abf`](https://github.com/inspect-js/typed-array-buffer/commit/7226abfda329b99dc25526c48740b076d128a7be) inspect-js-typed-array-buffer-a4141b6/LICENSE000066400000000000000000000020571473057365500206530ustar00rootroot00000000000000MIT License Copyright (c) 2023 Jordan Harband Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. inspect-js-typed-array-buffer-a4141b6/README.md000066400000000000000000000037161473057365500211300ustar00rootroot00000000000000# typed-array-buffer [![Version Badge][npm-version-svg]][package-url] [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] Get the ArrayBuffer out of a TypedArray, robustly. This will work in node <= 0.10 and < 0.11.4, where there's no prototype accessor, only a nonconfigurable own property. It will also work in modern engines where `TypedArray.prototype.buffer` has been deleted after this module has loaded. ## Example ```js const typedArrayBuffer = require('typed-array-buffer'); const assert = require('assert'); const arr = new Uint8Array(0); assert.equal(arr.buffer, typedArrayBuffer(arr)); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/typed-array-buffer [npm-version-svg]: https://versionbadg.es/inspect-js/typed-array-buffer.svg [deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer.svg [deps-url]: https://david-dm.org/inspect-js/typed-array-buffer [dev-deps-svg]: https://david-dm.org/inspect-js/typed-array-buffer/dev-status.svg [dev-deps-url]: https://david-dm.org/inspect-js/typed-array-buffer#info=devDependencies [npm-badge-png]: https://nodei.co/npm/typed-array-buffer.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/typed-array-buffer.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/typed-array-buffer.svg [downloads-url]: https://npm-stat.com/charts.html?package=typed-array-buffer [codecov-image]: https://codecov.io/gh/inspect-js/typed-array-buffer/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/typed-array-buffer/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/typed-array-buffer [actions-url]: https://github.com/inspect-js/typed-array-buffer/actions inspect-js-typed-array-buffer-a4141b6/index.d.ts000066400000000000000000000003431473057365500215430ustar00rootroot00000000000000import type { TypedArray } from 'is-typed-array'; declare namespace typedArrayBuffer{ export type { TypedArray }; } declare function typedArrayBuffer(x: typedArrayBuffer.TypedArray): ArrayBuffer; export = typedArrayBuffer; inspect-js-typed-array-buffer-a4141b6/index.js000066400000000000000000000011171473057365500213070ustar00rootroot00000000000000'use strict'; var $TypeError = require('es-errors/type'); var callBound = require('call-bound'); /** @type {undefined | ((thisArg: import('.').TypedArray) => Buffer)} */ var $typedArrayBuffer = callBound('TypedArray.prototype.buffer', true); var isTypedArray = require('is-typed-array'); /** @type {import('.')} */ // node <= 0.10, < 0.11.4 has a nonconfigurable own property instead of a prototype getter module.exports = $typedArrayBuffer || function typedArrayBuffer(x) { if (!isTypedArray(x)) { throw new $TypeError('Not a Typed Array'); } return x.buffer; }; inspect-js-typed-array-buffer-a4141b6/package.json000066400000000000000000000043451473057365500221360ustar00rootroot00000000000000{ "name": "typed-array-buffer", "version": "1.0.3", "description": "Get the ArrayBuffer out of a TypedArray, robustly.", "main": "index.js", "exports": { ".": "./index.js", "./package.json": "./package.json" }, "sideEffects": false, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublishOnly": "safe-publish-latest", "prepublish": "not-in-publish || npm run prepublishOnly", "lint": "eslint --ext=js,mjs .", "postlint": "tsc && attw -P", "pretest": "npm run lint", "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-buffer.git" }, "keywords": [ "typed array", "arraybuffer", "buffer" ], "author": "Jordan Harband ", "license": "MIT", "bugs": { "url": "https://github.com/inspect-js/typed-array-buffer/issues" }, "homepage": "https://github.com/inspect-js/typed-array-buffer#readme", "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.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/es-value-fixtures": "^1.4.4", "@types/for-each": "^0.3.3", "@types/object-inspect": "^1.13.0", "@types/tape": "^5.8.0", "auto-changelog": "^2.5.0", "available-typed-arrays": "^1.0.7", "encoding": "^0.1.13", "es-value-fixtures": "^1.5.0", "eslint": "=8.8.0", "for-each": "^0.3.3", "in-publish": "^2.0.1", "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 }, "publishConfig": { "ignore": [ ".github/workflows" ] } } inspect-js-typed-array-buffer-a4141b6/test/000077500000000000000000000000001473057365500206215ustar00rootroot00000000000000inspect-js-typed-array-buffer-a4141b6/test/index.js000066400000000000000000000013301473057365500222630ustar00rootroot00000000000000'use strict'; var test = require('tape'); var availableTypedArrays = require('available-typed-arrays')(); var forEach = require('for-each'); var v = require('es-value-fixtures'); var inspect = require('object-inspect'); var typedArrayBuffer = require('../'); test('typedArrayBuffer', function (t) { // @ts-expect-error TS sucks at concat forEach([].concat(v.primitives, v.objects), function (nonTA) { t['throws'](function () { typedArrayBuffer(nonTA); }, TypeError, inspect(nonTA) + ' is not a Typed Array'); }); forEach(availableTypedArrays, function (TA) { var ta = new global[TA](0); t.equal(typedArrayBuffer(ta), ta.buffer, inspect(ta) + ' has the same buffer as its own buffer property'); }); t.end(); }); inspect-js-typed-array-buffer-a4141b6/tsconfig.json000066400000000000000000000001641473057365500223520ustar00rootroot00000000000000{ "extends": "@ljharb/tsconfig", "compilerOptions": { "target": "es2021", }, "exclude": [ "coverage", ], }