pax_global_header00006660000000000000000000000064140202747700014515gustar00rootroot0000000000000052 comment=ecf0918b796aa7b731e92b596657f5e256901f1a is-shared-array-buffer-1.0.1/000077500000000000000000000000001402027477000157565ustar00rootroot00000000000000is-shared-array-buffer-1.0.1/.eslintignore000066400000000000000000000000121402027477000204520ustar00rootroot00000000000000coverage/ is-shared-array-buffer-1.0.1/.eslintrc000066400000000000000000000003161402027477000176020ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "operator-linebreak": [2, "before"], }, "overrides": [ { "files": "test/**", "globals": { "SharedArrayBuffer": false, }, }, ], } is-shared-array-buffer-1.0.1/.github/000077500000000000000000000000001402027477000173165ustar00rootroot00000000000000is-shared-array-buffer-1.0.1/.github/FUNDING.yml000066400000000000000000000011211402027477000211260ustar00rootroot00000000000000# 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/is-shared-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 up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] is-shared-array-buffer-1.0.1/.github/workflows/000077500000000000000000000000001402027477000213535ustar00rootroot00000000000000is-shared-array-buffer-1.0.1/.github/workflows/node-4+.yml000066400000000000000000000025321402027477000232410ustar00rootroot00000000000000name: 'Tests: node.js' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: latest: ${{ steps.set-matrix.outputs.requireds }} minors: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: preset: '>=4' latest: needs: [matrix] name: 'latest minors' runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.latest) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' minors: needs: [matrix, latest] name: 'non-latest minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.minors) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' node: name: 'node 4+' needs: [latest, minors] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-shared-array-buffer-1.0.1/.github/workflows/node-iojs.yml000066400000000000000000000026361402027477000237740ustar00rootroot00000000000000name: 'Tests: node.js (io.js)' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: latest: ${{ steps.set-matrix.outputs.requireds }} minors: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: preset: 'iojs' latest: needs: [matrix] name: 'latest minors' runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.latest) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' skip-ls-check: true minors: needs: [matrix, latest] name: 'non-latest minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.minors) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' skip-ls-check: true node: name: 'io.js' needs: [latest, minors] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-shared-array-buffer-1.0.1/.github/workflows/node-pretest.yml000066400000000000000000000010671402027477000245130ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: pretest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run pretest' with: node-version: 'lts/*' command: 'pretest' posttest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run posttest' with: node-version: 'lts/*' command: 'posttest' is-shared-array-buffer-1.0.1/.github/workflows/node-zero.yml000066400000000000000000000032041402027477000237770ustar00rootroot00000000000000name: 'Tests: node.js (0.x)' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: stable: ${{ steps.set-matrix.outputs.requireds }} unstable: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: preset: '0.x' stable: needs: [matrix] name: 'stable minors' runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.stable) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} skip-ls-check: true unstable: needs: [matrix, stable] name: 'unstable minors' continue-on-error: true if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.matrix.outputs.unstable) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/run@main name: 'npm install && npm run tests-only' with: node-version: ${{ matrix.node-version }} command: 'tests-only' cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} skip-ls-check: true node: name: 'node 0.x' needs: [stable, unstable] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-shared-array-buffer-1.0.1/.github/workflows/rebase.yml000066400000000000000000000004011402027477000233320ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} is-shared-array-buffer-1.0.1/.github/workflows/require-allow-edits.yml000066400000000000000000000003011402027477000257660ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main is-shared-array-buffer-1.0.1/.gitignore000066400000000000000000000032351402027477000177510ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-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/ # TypeScript v1 declaration files typings/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # 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 variables file .env .env.test # parcel-bundler cache (https://parceljs.org/) .cache # Next.js build output .next # 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 # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock is-shared-array-buffer-1.0.1/.npmignore000066400000000000000000000032601402027477000177560ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-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/ # TypeScript v1 declaration files typings/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # 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 variables file .env .env.test # parcel-bundler cache (https://parceljs.org/) .cache # Next.js build output .next # 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 # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .github/workflows is-shared-array-buffer-1.0.1/.npmrc000066400000000000000000000000671402027477000171010ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s is-shared-array-buffer-1.0.1/.nycrc000066400000000000000000000003301402027477000170710ustar00rootroot00000000000000{ "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" ] } is-shared-array-buffer-1.0.1/CHANGELOG.md000066400000000000000000000041201402027477000175640ustar00rootroot00000000000000# 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.1](https://github.com/inspect-js/is-shared-array-buffer/compare/v1.0.0...v1.0.1) - 2021-03-04 ### Commits - [readme] fix repo URLs [`37c38f3`](https://github.com/inspect-js/is-shared-array-buffer/commit/37c38f347392da177197dd2fd518b61240a56203) ## v1.0.0 - 2021-03-04 ### Commits - [Tests] add tests [`9c7b806`](https://github.com/inspect-js/is-shared-array-buffer/commit/9c7b806ab1528814308a7420f8198644f55c916f) - Initial commit [`4e65c5e`](https://github.com/inspect-js/is-shared-array-buffer/commit/4e65c5ecdaa255162bc6507de4ff98cea2472e3b) - [meta] do not publish github action workflow files [`ac3693d`](https://github.com/inspect-js/is-shared-array-buffer/commit/ac3693db8ec26db5444ef4b46aa38a81e8841d30) - readme [`7a984d0`](https://github.com/inspect-js/is-shared-array-buffer/commit/7a984d0db73b77943f6731098134e3351a36793b) - npm init [`a586c99`](https://github.com/inspect-js/is-shared-array-buffer/commit/a586c99316f3c8ae4fd5125621ea933e97a1bf1b) - [actions] add automatic rebasing / merge commit blocking [`184fe62`](https://github.com/inspect-js/is-shared-array-buffer/commit/184fe622680d523e89ac322fa1a52dbba46a8fc0) - Implementation [`207e26d`](https://github.com/inspect-js/is-shared-array-buffer/commit/207e26d1128930f28384cb213b38d69fd52bbd7c) - [meta] create `FUNDING.yml`; add "funding" field [`3cad3fc`](https://github.com/inspect-js/is-shared-array-buffer/commit/3cad3fc9509f91fbc71e84565529f53a94d538d4) - [meta] add auto-changelog [`31f1f2c`](https://github.com/inspect-js/is-shared-array-buffer/commit/31f1f2cbcd616d6c09089d62198d5cc775053324) - [Tests] add `npm run lint` [`2e5146e`](https://github.com/inspect-js/is-shared-array-buffer/commit/2e5146e18f44533382a781fa09a50d4f47caa0e5) - Only apps should have lockfiles [`7b2adfa`](https://github.com/inspect-js/is-shared-array-buffer/commit/7b2adfad6dcd95271ab6ba34658a9a1a21dbeacf) is-shared-array-buffer-1.0.1/LICENSE000066400000000000000000000020531402027477000167630ustar00rootroot00000000000000MIT License Copyright (c) 2021 Inspect JS 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. is-shared-array-buffer-1.0.1/README.md000066400000000000000000000040641402027477000172410ustar00rootroot00000000000000# is-shared-array-buffer [![Version Badge][2]][1] [![dependency status][5]][6] [![dev dependency status][7]][8] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][11]][1] Is this value a JS SharedArrayBuffer? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag. ## Example ```js var assert = require('assert'); var isSharedArrayBuffer = require('is-shared-array-buffer'); assert(!isSharedArrayBuffer(function () {})); assert(!isSharedArrayBuffer(null)); assert(!isSharedArrayBuffer(function* () { yield 42; return Infinity; }); assert(!isSharedArrayBuffer(Symbol('foo'))); assert(!isSharedArrayBuffer(1n)); assert(!isSharedArrayBuffer(Object(1n))); assert(!isSharedArrayBuffer(new Set())); assert(!isSharedArrayBuffer(new WeakSet())); assert(!isSharedArrayBuffer(new Map())); assert(!isSharedArrayBuffer(new WeakMap())); assert(!isSharedArrayBuffer(new WeakRef({}))); assert(!isSharedArrayBuffer(new FinalizationRegistry(() => {}))); assert(!isSharedArrayBuffer(new ArrayBuffer())); assert(isSharedArrayBuffer(new SharedArrayBuffer())); class MySharedArrayBuffer extends SharedArrayBuffer {} assert(isSharedArrayBuffer(new MySharedArrayBuffer())); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [1]: https://npmjs.org/package/is-shared-array-buffer [2]: https://versionbadg.es/inspect-js/is-shared-array-buffer.svg [5]: https://david-dm.org/inspect-js/is-shared-array-buffer.svg [6]: https://david-dm.org/inspect-js/is-shared-array-buffer [7]: https://david-dm.org/inspect-js/is-shared-array-buffer/dev-status.svg [8]: https://david-dm.org/inspect-js/is-shared-array-buffer#info=devDependencies [11]: https://nodei.co/npm/is-shared-array-buffer.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/is-shared-array-buffer.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/is-shared-array-buffer.svg [downloads-url]: https://npm-stat.com/charts.html?package=is-shared-array-buffer is-shared-array-buffer-1.0.1/index.js000066400000000000000000000007061402027477000174260ustar00rootroot00000000000000'use strict'; var callBound = require('call-bind/callBound'); var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true); module.exports = $byteLength ? function isSharedArrayBuffer(obj) { if (!obj || typeof obj !== 'object') { return false; } try { $byteLength(obj); return true; } catch (e) { return false; } } : function isSharedArrayBuffer(obj) { // eslint-disable-line no-unused-vars return false; }; is-shared-array-buffer-1.0.1/package.json000066400000000000000000000031661402027477000202520ustar00rootroot00000000000000{ "name": "is-shared-array-buffer", "version": "1.0.1", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" }, "funding": { "url": "https://github.com/sponsors/ljharb" }, "description": "Is this value a JS SharedArrayBuffer?", "license": "MIT", "main": "index.js", "exports": { ".": "./index.js", "./package.json": "./package.json" }, "scripts": { "lint": "eslint --ext=.js,.mjs .", "pretest": "npm run lint", "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/is-shared-array-buffer.git" }, "keywords": [ "javascript", "ecmascript", "is", "sharedarraybuffer", "shared", "array", "buffer" ], "bugs": { "url": "https://github.com/inspect-js/is-shared-array-buffer/issues" }, "homepage": "https://github.com/inspect-js/is-shared-array-buffer#readme", "devDependencies": { "@ljharb/eslint-config": "^17.5.1", "aud": "^1.1.4", "auto-changelog": "^2.2.1", "es-value-fixtures": "^1.2.1", "eslint": "^7.21.0", "for-each": "^0.3.3", "nyc": "^10.3.2", "object-inspect": "^1.9.0", "tape": "^5.2.2" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true } } is-shared-array-buffer-1.0.1/test/000077500000000000000000000000001402027477000167355ustar00rootroot00000000000000is-shared-array-buffer-1.0.1/test/index.js000066400000000000000000000014011402027477000203760ustar00rootroot00000000000000'use strict'; var test = require('tape'); var inspect = require('object-inspect'); var forEach = require('for-each'); var v = require('es-value-fixtures'); var isSharedArrayBuffer = require('..'); test('isSharedArrayBuffer', function (t) { t.equal(typeof isSharedArrayBuffer, 'function', 'is a function'); var nonSABs = v.primitives.concat(v.objects); forEach(nonSABs, function (nonSAB) { t.equal(isSharedArrayBuffer(nonSAB), false, inspect(nonSAB) + ' is not a SharedArrayBuffer'); }); t.test('actual SharedArrayBuffer instances', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) { var sab = new SharedArrayBuffer(); st.equal(isSharedArrayBuffer(sab), true, inspect(sab) + ' is a SharedArrayBuffer'); st.end(); }); t.end(); });