pax_global_header00006660000000000000000000000064144554246170014526gustar00rootroot0000000000000052 comment=dfc590903cc934c32cbfce5a290cc3315adf5566 is-typed-array-1.1.12/000077500000000000000000000000001445542461700144625ustar00rootroot00000000000000is-typed-array-1.1.12/.eslintrc000066400000000000000000000002241445542461700163040ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "globals": { "globalThis": false }, "rules": { "max-statements-per-line": [2, { "max": 2 }] }, } is-typed-array-1.1.12/.github/000077500000000000000000000000001445542461700160225ustar00rootroot00000000000000is-typed-array-1.1.12/.github/FUNDING.yml000066400000000000000000000011111445542461700176310ustar00rootroot00000000000000# 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-typed-array 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-typed-array-1.1.12/.github/workflows/000077500000000000000000000000001445542461700200575ustar00rootroot00000000000000is-typed-array-1.1.12/.github/workflows/node-aught.yml000066400000000000000000000005161445542461700226370ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] 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' is-typed-array-1.1.12/.github/workflows/node-harmony.yml000066400000000000000000000005701445542461700232040ustar00rootroot00000000000000name: 'Tests: node.js (harmony)' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>=0.4 <16' type: minors command: npm run test:harmony skip-ls-check: true node: name: 'node: harmony' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' is-typed-array-1.1.12/.github/workflows/node-pretest.yml000066400000000000000000000002061445542461700232110ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main is-typed-array-1.1.12/.github/workflows/node-tens.yml000066400000000000000000000005211445542461700224740ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] 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' is-typed-array-1.1.12/.github/workflows/rebase.yml000066400000000000000000000002571445542461700220470ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] jobs: _: uses: ljharb/actions/.github/workflows/rebase.yml@main secrets: token: ${{ secrets.GITHUB_TOKEN }} is-typed-array-1.1.12/.github/workflows/require-allow-edits.yml000066400000000000000000000003031445542461700244740ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main is-typed-array-1.1.12/.gitignore000066400000000000000000000011721445542461700164530ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage .nyc_output/ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # node-waf configuration .lock-wscript # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore is-typed-array-1.1.12/.npmrc000066400000000000000000000000671445542461700156050ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s is-typed-array-1.1.12/.nycrc000066400000000000000000000002131445542461700155750ustar00rootroot00000000000000{ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], "exclude": [ "coverage", "test" ] } is-typed-array-1.1.12/CHANGELOG.md000066400000000000000000000140101445542461700162670ustar00rootroot00000000000000# 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.1.12](https://github.com/inspect-js/is-typed-array/compare/v1.1.11...v1.1.12) - 2023-07-17 ### Commits - [Refactor] use `which-typed-array` for all internals [`7619405`](https://github.com/inspect-js/is-typed-array/commit/761940532de595f6721fed101b02814dcfa7fe4e) ## [v1.1.11](https://github.com/inspect-js/is-typed-array/compare/v1.1.10...v1.1.11) - 2023-07-17 ### Commits - [Fix] `node < v0.6` lacks proper Object toString behavior [`c94b90d`](https://github.com/inspect-js/is-typed-array/commit/c94b90dc6bc457783d6f8cc208415a49da0933b7) - [Robustness] use `call-bind` [`573b00b`](https://github.com/inspect-js/is-typed-array/commit/573b00b8deec42ac1ac262415e442ea0b7e1c96b) - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`c88c2d4`](https://github.com/inspect-js/is-typed-array/commit/c88c2d479976110478fa4038fe8921251c06a163) ## [v1.1.10](https://github.com/inspect-js/is-typed-array/compare/v1.1.9...v1.1.10) - 2022-11-02 ### Commits - [meta] add `auto-changelog` [`cf6d86b`](https://github.com/inspect-js/is-typed-array/commit/cf6d86bf2f693eca357439d4d12e76d641f91f92) - [actions] update rebase action to use reusable workflow [`8da51a5`](https://github.com/inspect-js/is-typed-array/commit/8da51a5dce6d2442ae31ccbc2be136f2e04d6bef) - [Dev Deps] update `aud`, `is-callable`, `object-inspect`, `tape` [`554e3de`](https://github.com/inspect-js/is-typed-array/commit/554e3deec59dec926d0badc628e589ab363e465b) - [Refactor] use `gopd` instead of an `es-abstract` helper` [`cdaa465`](https://github.com/inspect-js/is-typed-array/commit/cdaa465d5f94bfc9e32475e31209e1c2458a9603) - [Deps] update `es-abstract` [`677ae4b`](https://github.com/inspect-js/is-typed-array/commit/677ae4b3c8323b59d6650a9254ab945045c33f79) 1.1.9 / 2022-05-13 ================= * [Refactor] use `foreach` instead of `for-each` * [readme] markdown URL cleanup * [Deps] update `es-abstract` * [meta] use `npmignore` to autogenerate an npmignore file * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` * [actions] reuse common workflows * [actions] update codecov uploader 1.1.8 / 2021-08-30 ================= * [Refactor] use `globalThis` if available (#53) * [Deps] update `available-typed-arrays` * [Dev Deps] update `@ljharb/eslint-config` 1.1.7 / 2021-08-07 ================= * [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString * [Dev Deps] update `is-callable`, `tape` 1.1.6 / 2021-08-05 ================= * [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams * [readme] add actions and codecov badges * [meta] use `prepublishOnly` script for npm 7+ * [Deps] update `available-typed-arrays`, `es-abstract` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` * [actions] use `node/install` instead of `node/run`; use `codecov` action 1.1.5 / 2021-02-14 ================= * [meta] do not publish github action workflow files or nyc output * [Deps] update `call-bind`, `es-abstract` * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `is-callable`, `tape` 1.1.4 / 2020-12-05 ================= * [readme] fix repo URLs, remove defunct badges * [Deps] update `available-typed-arrays`, `es-abstract`; use `call-bind` where applicable * [meta] gitignore nyc output * [meta] only audit prod deps * [actions] add "Allow Edits" workflow * [actions] switch Automatic Rebase workflow to `pull_request_target` event * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `make-arrow-function`, `make-generator-function`, `object-inspect`, `tape`; add `aud` * [Tests] migrate tests to Github Actions * [Tests] run `nyc` on all tests 1.1.3 / 2020-01-24 ================= * [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols` 1.1.2 / 2020-01-20 ================= * [Fix] in envs without Symbol.toStringTag, dc8a8cc made arrays return `true` * [Tests] add `evalmd` to `prelint` 1.1.1 / 2020-01-18 ================= * [Robustness] don’t rely on Array.prototype.indexOf existing * [meta] remove unused Makefile and associated utilities * [meta] add `funding` field; create FUNDING.yml * [actions] add automatic rebasing / merge commit blocking * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `replace`, `semver`, `tape`; add `safe-publish-latest` * [Tests] use shared travis-ci configs * [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops 1.1.0 / 2019-02-16 ================= * [New] add `BigInt64Array` and `BigUint64Array` * [Refactor] use an array instead of an object for storing Typed Array names * [meta] ignore `test.html` * [Tests] up to `node` `v11.10`, `v10.15`, `v8.15`, `v7.10`, `v6.16`, `v5.10`, `v4.9` * [Tests] remove `jscs` * [Tests] use `npm audit` instead of `nsp` * [Dev Deps] update `eslint`,` @ljharb/eslint-config`, `is-callable`, `tape`, `replace`, `semver` * [Dev Deps] remove unused eccheck script + dep 1.0.4 / 2016-03-19 ================= * [Fix] `Symbol.toStringTag` is on the super-`[[Prototype]]` of Float32Array, not the `[[Prototype]]` (#3) * [Tests] up to `node` `v5.9`, `v4.4` * [Tests] use pretest/posttest for linting/security * [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `is-callable` 1.0.3 / 2015-10-13 ================= * [Deps] Add missing `foreach` dependency (#1) 1.0.2 / 2015-10-05 ================= * [Deps] Remove unneeded "isarray" dependency * [Dev Deps] update `eslint`, `@ljharb/eslint-config` 1.0.1 / 2015-10-02 ================= * Rerelease: avoid instanceof and the constructor property; work cross-realm; work with Symbol.toStringTag. 1.0.0 / 2015-05-06 ================= * Initial release. is-typed-array-1.1.12/LICENSE000066400000000000000000000020721445542461700154700ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 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. is-typed-array-1.1.12/README.md000066400000000000000000000060611445542461700157440ustar00rootroot00000000000000# is-typed-array [![Version Badge][npm-version-svg]][package-url] [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![dependency status][5]][6] [![dev dependency status][7]][8] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag. ## Example ```js var isTypedArray = require('is-typed-array'); var assert = require('assert'); assert.equal(false, isTypedArray(undefined)); assert.equal(false, isTypedArray(null)); assert.equal(false, isTypedArray(false)); assert.equal(false, isTypedArray(true)); assert.equal(false, isTypedArray([])); assert.equal(false, isTypedArray({})); assert.equal(false, isTypedArray(/a/g)); assert.equal(false, isTypedArray(new RegExp('a', 'g'))); assert.equal(false, isTypedArray(new Date())); assert.equal(false, isTypedArray(42)); assert.equal(false, isTypedArray(NaN)); assert.equal(false, isTypedArray(Infinity)); assert.equal(false, isTypedArray(new Number(42))); assert.equal(false, isTypedArray('foo')); assert.equal(false, isTypedArray(Object('foo'))); assert.equal(false, isTypedArray(function () {})); assert.equal(false, isTypedArray(function* () {})); assert.equal(false, isTypedArray(x => x * x)); assert.equal(false, isTypedArray([])); assert.ok(isTypedArray(new Int8Array())); assert.ok(isTypedArray(new Uint8Array())); assert.ok(isTypedArray(new Uint8ClampedArray())); assert.ok(isTypedArray(new Int16Array())); assert.ok(isTypedArray(new Uint16Array())); assert.ok(isTypedArray(new Int32Array())); assert.ok(isTypedArray(new Uint32Array())); assert.ok(isTypedArray(new Float32Array())); assert.ok(isTypedArray(new Float64Array())); assert.ok(isTypedArray(new BigInt64Array())); assert.ok(isTypedArray(new BigUint64Array())); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/is-typed-array [npm-version-svg]: https://versionbadg.es/inspect-js/is-typed-array.svg [deps-svg]: https://david-dm.org/inspect-js/is-typed-array.svg [deps-url]: https://david-dm.org/inspect-js/is-typed-array [dev-deps-svg]: https://david-dm.org/inspect-js/is-typed-array/dev-status.svg [dev-deps-url]: https://david-dm.org/inspect-js/is-typed-array#info=devDependencies [npm-badge-png]: https://nodei.co/npm/is-typed-array.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/is-typed-array.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/is-typed-array.svg [downloads-url]: https://npm-stat.com/charts.html?package=is-typed-array [codecov-image]: https://codecov.io/gh/inspect-js/is-typed-array/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/is-typed-array/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-typed-array [actions-url]: https://github.com/inspect-js/is-typed-array/actions is-typed-array-1.1.12/index.js000066400000000000000000000002311445542461700161230ustar00rootroot00000000000000'use strict'; var whichTypedArray = require('which-typed-array'); module.exports = function isTypedArray(value) { return !!whichTypedArray(value); }; is-typed-array-1.1.12/package.json000066400000000000000000000055021445542461700167520ustar00rootroot00000000000000{ "name": "is-typed-array", "version": "1.1.12", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" }, "funding": { "url": "https://github.com/sponsors/ljharb" }, "contributors": [ { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" } ], "description": "Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag.", "license": "MIT", "main": "index.js", "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 .", "pretest": "npm run --silent lint", "test": "npm run tests-only && npm run test:harmony", "tests-only": "nyc tape test", "test:harmony": "nyc node --harmony --es-staging test", "posttest": "npx 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://github.com/inspect-js/is-typed-array.git" }, "keywords": [ "array", "TypedArray", "typed array", "is", "typed", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "ES6", "toStringTag", "Symbol.toStringTag", "@@toStringTag" ], "dependencies": { "which-typed-array": "^1.1.11" }, "devDependencies": { "@ljharb/eslint-config": "^21.1.0", "aud": "^2.0.3", "auto-changelog": "^2.4.0", "eslint": "=8.8.0", "evalmd": "^0.0.19", "for-each": "^0.3.3", "has-tostringtag": "^1.0.0", "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.5" }, "testling": { "files": "test/index.js", "browsers": [ "iexplore/6.0..latest", "firefox/3.0..6.0", "firefox/15.0..latest", "firefox/nightly", "chrome/4.0..10.0", "chrome/20.0..latest", "chrome/canary", "opera/10.0..latest", "opera/next", "safari/4.0..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2" ] }, "engines": { "node": ">= 0.4" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true, "startingVersion": "1.1.10" }, "publishConfig": { "ignore": [ ".github/workflows" ] } } is-typed-array-1.1.12/test/000077500000000000000000000000001445542461700154415ustar00rootroot00000000000000is-typed-array-1.1.12/test/index.js000066400000000000000000000060301445542461700171050ustar00rootroot00000000000000'use strict'; var test = require('tape'); var isTypedArray = require('../'); var isCallable = require('is-callable'); var hasToStringTag = require('has-tostringtag/shams')(); var generators = require('make-generator-function')(); var arrowFn = require('make-arrow-function')(); var forEach = require('for-each'); var inspect = require('object-inspect'); var typedArrayNames = [ 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array' ]; test('not arrays', function (t) { t.test('non-number/string primitives', function (st) { st.notOk(isTypedArray(), 'undefined is not typed array'); st.notOk(isTypedArray(null), 'null is not typed array'); st.notOk(isTypedArray(false), 'false is not typed array'); st.notOk(isTypedArray(true), 'true is not typed array'); st.end(); }); t.notOk(isTypedArray({}), 'object is not typed array'); t.notOk(isTypedArray(/a/g), 'regex literal is not typed array'); t.notOk(isTypedArray(new RegExp('a', 'g')), 'regex object is not typed array'); t.notOk(isTypedArray(new Date()), 'new Date() is not typed array'); t.test('numbers', function (st) { st.notOk(isTypedArray(42), 'number is not typed array'); st.notOk(isTypedArray(Object(42)), 'number object is not typed array'); st.notOk(isTypedArray(NaN), 'NaN is not typed array'); st.notOk(isTypedArray(Infinity), 'Infinity is not typed array'); st.end(); }); t.test('strings', function (st) { st.notOk(isTypedArray('foo'), 'string primitive is not typed array'); st.notOk(isTypedArray(Object('foo')), 'string object is not typed array'); st.end(); }); t.end(); }); test('Functions', function (t) { t.notOk(isTypedArray(function () {}), 'function is not typed array'); t.end(); }); test('Generators', { skip: generators.length === 0 }, function (t) { forEach(generators, function (genFn) { t.notOk(isTypedArray(genFn), 'generator function ' + inspect(genFn) + ' is not typed array'); }); t.end(); }); test('Arrow functions', { skip: !arrowFn }, function (t) { t.notOk(isTypedArray(arrowFn), 'arrow function is not typed array'); t.end(); }); test('@@toStringTag', { skip: !hasToStringTag }, function (t) { forEach(typedArrayNames, function (typedArray) { if (typeof global[typedArray] === 'function') { var fakeTypedArray = []; fakeTypedArray[Symbol.toStringTag] = typedArray; t.notOk(isTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array'); } else { t.comment('# SKIP ' + typedArray + ' is not supported'); } }); t.end(); }); test('non-Typed Arrays', function (t) { t.notOk(isTypedArray([]), '[] is not typed array'); t.end(); }); test('Typed Arrays', function (t) { forEach(typedArrayNames, function (typedArray) { var TypedArray = global[typedArray]; if (isCallable(TypedArray)) { var arr = new TypedArray(10); t.ok(isTypedArray(arr), 'new ' + typedArray + '(10) is typed array'); } else { t.comment('# SKIP ' + typedArray + ' is not supported'); } }); t.end(); });