pax_global_header 0000666 0000000 0000000 00000000064 14731171274 0014521 g ustar 00root root 0000000 0000000 52 comment=38603a5b40cc02824054ec549cbf4a14c96cca41
inspect-js-data-view-buffer-3e1be55/ 0000775 0000000 0000000 00000000000 14731171274 0017341 5 ustar 00root root 0000000 0000000 inspect-js-data-view-buffer-3e1be55/.eslintrc 0000664 0000000 0000000 00000000270 14731171274 0021164 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"globals": {
"DataView": false,
},
"rules": {
"new-cap": ["error", {
"capIsNewExceptions": [
"GetIntrinsic",
],
}],
},
}
inspect-js-data-view-buffer-3e1be55/.github/ 0000775 0000000 0000000 00000000000 14731171274 0020701 5 ustar 00root root 0000000 0000000 inspect-js-data-view-buffer-3e1be55/.github/FUNDING.yml 0000664 0000000 0000000 00000001062 14731171274 0022515 0 ustar 00root root 0000000 0000000 # 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/data-view-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-data-view-buffer-3e1be55/.github/workflows/ 0000775 0000000 0000000 00000000000 14731171274 0022736 5 ustar 00root root 0000000 0000000 inspect-js-data-view-buffer-3e1be55/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000565 14731171274 0025522 0 ustar 00root root 0000000 0000000 name: '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
skip-ls-check: true
node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
inspect-js-data-view-buffer-3e1be55/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000245 14731171274 0026073 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
inspect-js-data-view-buffer-3e1be55/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000547 14731171274 0025363 0 ustar 00root root 0000000 0000000 name: '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-data-view-buffer-3e1be55/.github/workflows/node-twenties.yml 0000664 0000000 0000000 00000000536 14731171274 0026252 0 ustar 00root root 0000000 0000000 name: '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-data-view-buffer-3e1be55/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000257 14731171274 0024726 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
inspect-js-data-view-buffer-3e1be55/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000515 14731171274 0027360 0 ustar 00root root 0000000 0000000 name: 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-data-view-buffer-3e1be55/.gitignore 0000664 0000000 0000000 00000004136 14731171274 0021335 0 ustar 00root root 0000000 0000000 # 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-data-view-buffer-3e1be55/.npmrc 0000664 0000000 0000000 00000000067 14731171274 0020464 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
inspect-js-data-view-buffer-3e1be55/.nycrc 0000664 0000000 0000000 00000000330 14731171274 0020454 0 ustar 00root root 0000000 0000000 {
"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-data-view-buffer-3e1be55/CHANGELOG.md 0000664 0000000 0000000 00000006044 14731171274 0021156 0 ustar 00root root 0000000 0000000 # 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.2](https://github.com/inspect-js/data-view-buffer/compare/v1.0.1...v1.0.2) - 2024-12-19
### Commits
- [actions] split out node 10-20, and 20+ [`f99dc3f`](https://github.com/inspect-js/data-view-buffer/commit/f99dc3f4c0edc7ffa3cc96302b1c0c96663d0a48)
- [types] use shared tsconfig [`9ad8630`](https://github.com/inspect-js/data-view-buffer/commit/9ad86303de5ccef0daf248177b50f33316d1b3d5)
- [readme] update URLs [`d3c66fb`](https://github.com/inspect-js/data-view-buffer/commit/d3c66fb4426b8d57834dea4842a06ef4ad7c4695)
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, `tape` [`7dda732`](https://github.com/inspect-js/data-view-buffer/commit/7dda732235b65fe23608ac8a0a55207c53236a20)
- [Refactor] use `call-bound` directly [`5e124f9`](https://github.com/inspect-js/data-view-buffer/commit/5e124f92ef654f32c67d9eb12d19ecf1b42d8e6f)
- [Deps] update `call-bind`, `is-data-view` [`73fb1a4`](https://github.com/inspect-js/data-view-buffer/commit/73fb1a47dba2f1be13101770fc5dcae8e79a67fa)
- [Tests] replace `aud` with `npm audit` [`64563a3`](https://github.com/inspect-js/data-view-buffer/commit/64563a3cb83ee6ddc969de8fadf9379300933187)
- [Dev Deps] update `@ljharb/tsconfig` [`b842ce8`](https://github.com/inspect-js/data-view-buffer/commit/b842ce8adf17cf59158a3906a092d1dc5e6c10f9)
- [Deps] update `call-bind` [`bc89873`](https://github.com/inspect-js/data-view-buffer/commit/bc89873b8b4d657284a731f53cec9e69fe35057d)
- [Dev Deps] update `tape` [`b6ed8cb`](https://github.com/inspect-js/data-view-buffer/commit/b6ed8cb5804237d6f4e6bb2e3c1418c7ac3acc9b)
- [Dev Deps] add missing peer dep [`ba96a94`](https://github.com/inspect-js/data-view-buffer/commit/ba96a94c8d1afda58f302a4fc294a2633462b18a)
## [v1.0.1](https://github.com/inspect-js/data-view-buffer/compare/v1.0.0...v1.0.1) - 2024-02-06
### Commits
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`675f588`](https://github.com/inspect-js/data-view-buffer/commit/675f588236e489268de9f7a0adf33ef8295a3c71)
- [Deps] update `call-bind`, `get-intrinsic` [`e6eb209`](https://github.com/inspect-js/data-view-buffer/commit/e6eb209578556ade150f0c3945cdeec9ffc582e2)
## v1.0.0 - 2024-02-02
### Commits
- Initial implementation, tests, readme, types [`2e1382b`](https://github.com/inspect-js/data-view-buffer/commit/2e1382b26a98acc6f2ade4a061e1cd829e3043b8)
- Initial commit [`1eb7dc4`](https://github.com/inspect-js/data-view-buffer/commit/1eb7dc4a0369d8320406bd7f9366c7887888790e)
- npm init [`d9e3d47`](https://github.com/inspect-js/data-view-buffer/commit/d9e3d4707b54bf77de30565ea5c6c0fcdf4a0ecc)
- Only apps should have lockfiles [`116b60b`](https://github.com/inspect-js/data-view-buffer/commit/116b60b9054de3331cd3c1599280466405c0d128)
inspect-js-data-view-buffer-3e1be55/LICENSE 0000664 0000000 0000000 00000002057 14731171274 0020352 0 ustar 00root root 0000000 0000000 MIT 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-data-view-buffer-3e1be55/README.md 0000664 0000000 0000000 00000003672 14731171274 0020630 0 ustar 00root root 0000000 0000000 # data-view-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 DataView, 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 `DataView.prototype.buffer` has been deleted after this module has loaded.
## Example
```js
const dataViewBuffer = require('data-view-buffer');
const assert = require('assert');
const ab = new ArrayBuffer(0);
const dv = new DataView(ab);
assert.equal(dataViewBuffer(dv), ab);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/data-view-buffer
[npm-version-svg]: https://versionbadg.es/inspect-js/data-view-buffer.svg
[deps-svg]: https://david-dm.org/inspect-js/data-view-buffer.svg
[deps-url]: https://david-dm.org/inspect-js/data-view-buffer
[dev-deps-svg]: https://david-dm.org/inspect-js/data-view-buffer/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/data-view-buffer#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/data-view-buffer.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/data-view-buffer.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/data-view-buffer.svg
[downloads-url]: https://npm-stat.com/charts.html?package=data-view-buffer
[codecov-image]: https://codecov.io/gh/inspect-js/data-view-buffer/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/data-view-buffer/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/data-view-buffer
[actions-url]: https://github.com/inspect-js/data-view-buffer/actions
inspect-js-data-view-buffer-3e1be55/index.d.ts 0000664 0000000 0000000 00000000220 14731171274 0021234 0 ustar 00root root 0000000 0000000 declare function dataViewBuffer(value: DataView): ArrayBuffer;
declare function dataViewBuffer(value: unknown): never;
export = dataViewBuffer; inspect-js-data-view-buffer-3e1be55/index.js 0000664 0000000 0000000 00000000745 14731171274 0021014 0 ustar 00root root 0000000 0000000 'use strict';
var $TypeError = require('es-errors/type');
var callBound = require('call-bound');
var $dataViewBuffer = callBound('DataView.prototype.buffer', true);
var isDataView = require('is-data-view');
// node <= 0.10, < 0.11.4 has a nonconfigurable own property instead of a prototype getter
/** @type {import('.')} */
module.exports = $dataViewBuffer || function dataViewBuffer(x) {
if (!isDataView(x)) {
throw new $TypeError('not a DataView');
}
return x.buffer;
};
inspect-js-data-view-buffer-3e1be55/package.json 0000664 0000000 0000000 00000004460 14731171274 0021633 0 ustar 00root root 0000000 0000000 {
"name": "data-view-buffer",
"version": "1.0.2",
"description": "Get the ArrayBuffer out of a DataView, robustly.",
"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",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -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)\")\""
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/data-view-buffer.git"
},
"keywords": [
"javascript",
"ecmascript",
"dataview",
"buffer",
"robust"
],
"author": "Jordan Harband ",
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/data-view-buffer/issues"
},
"homepage": "https://github.com/inspect-js/data-view-buffer#readme",
"dependencies": {
"call-bound": "^1.0.3",
"es-errors": "^1.3.0",
"is-data-view": "^1.0.2"
},
"devDependencies": {
"@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",
"encoding": "^0.1.13",
"es-value-fixtures": "^1.5.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"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-data-view-buffer-3e1be55/test/ 0000775 0000000 0000000 00000000000 14731171274 0020320 5 ustar 00root root 0000000 0000000 inspect-js-data-view-buffer-3e1be55/test/index.js 0000664 0000000 0000000 00000001677 14731171274 0022000 0 ustar 00root root 0000000 0000000 'use strict';
var test = require('tape');
var forEach = require('for-each');
var v = require('es-value-fixtures');
var inspect = require('object-inspect');
var dataViewBuffer = require('../');
test('dataViewBuffer', function (t) {
forEach(
// @ts-expect-error TS sucks at [].concat
// eslint-disable-next-line no-extra-parens
/** @type {[...typeof v.primitives, ...typeof v.objects]} */ ([].concat(v.primitives, v.objects)),
function (nonDV) {
t['throws'](function () { dataViewBuffer(nonDV); }, TypeError, inspect(nonDV) + ' is not a DataView');
}
);
t.test('DataView', { skip: typeof DataView !== 'function' }, function (st) {
var ab = new ArrayBuffer(1);
var dv = new DataView(ab);
st.equal(dataViewBuffer(dv), ab, inspect(dv) + ' has the same buffer originally passed to the DataView');
st.equal(dataViewBuffer(dv), dv.buffer, inspect(dv) + ' has the same buffer as its own buffer property');
st.end();
});
t.end();
});
inspect-js-data-view-buffer-3e1be55/tsconfig.json 0000664 0000000 0000000 00000000410 14731171274 0022043 0 ustar 00root root 0000000 0000000 {
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
},
"exclude": [
"coverage",
"test/list-exports"
],
}