pax_global_header00006660000000000000000000000064125257643340014525gustar00rootroot0000000000000052 comment=0617cfa871686cf541af62b144f130488f44f6fe is-typedarray-1.0.0/000077500000000000000000000000001252576433400143205ustar00rootroot00000000000000is-typedarray-1.0.0/LICENSE.md000066400000000000000000000020611252576433400157230ustar00rootroot00000000000000This software is released under the MIT license: 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-typedarray-1.0.0/README.md000066400000000000000000000010561252576433400156010ustar00rootroot00000000000000# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) Detect whether or not an object is a [Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). ## Usage [![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) ### isTypedArray(array) Returns `true` when array is a Typed Array, and `false` when it is not. ## License MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. is-typedarray-1.0.0/index.js000066400000000000000000000017701252576433400157720ustar00rootroot00000000000000module.exports = isTypedArray isTypedArray.strict = isStrictTypedArray isTypedArray.loose = isLooseTypedArray var toString = Object.prototype.toString var names = { '[object Int8Array]': true , '[object Int16Array]': true , '[object Int32Array]': true , '[object Uint8Array]': true , '[object Uint8ClampedArray]': true , '[object Uint16Array]': true , '[object Uint32Array]': true , '[object Float32Array]': true , '[object Float64Array]': true } function isTypedArray(arr) { return ( isStrictTypedArray(arr) || isLooseTypedArray(arr) ) } function isStrictTypedArray(arr) { return ( arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array ) } function isLooseTypedArray(arr) { return names[toString.call(arr)] } is-typedarray-1.0.0/package.json000066400000000000000000000012311252576433400166030ustar00rootroot00000000000000{ "name": "is-typedarray", "version": "1.0.0", "description": "Detect whether or not an object is a Typed Array", "main": "index.js", "scripts": { "test": "node test" }, "author": "Hugh Kennedy (http://hughsk.io/)", "license": "MIT", "dependencies": {}, "devDependencies": { "tape": "^2.13.1" }, "repository": { "type": "git", "url": "git://github.com/hughsk/is-typedarray.git" }, "keywords": [ "typed", "array", "detect", "is", "util" ], "bugs": { "url": "https://github.com/hughsk/is-typedarray/issues" }, "homepage": "https://github.com/hughsk/is-typedarray" } is-typedarray-1.0.0/test.js000066400000000000000000000021071252576433400156350ustar00rootroot00000000000000var test = require('tape') var ista = require('./') test('strict', function(t) { t.ok(ista.strict(new Int8Array), 'Int8Array') t.ok(ista.strict(new Int16Array), 'Int16Array') t.ok(ista.strict(new Int32Array), 'Int32Array') t.ok(ista.strict(new Uint8Array), 'Uint8Array') t.ok(ista.strict(new Uint16Array), 'Uint16Array') t.ok(ista.strict(new Uint32Array), 'Uint32Array') t.ok(ista.strict(new Float32Array), 'Float32Array') t.ok(ista.strict(new Float64Array), 'Float64Array') t.ok(!ista.strict(new Array), 'Array') t.ok(!ista.strict([]), '[]') t.end() }) test('loose', function(t) { t.ok(ista.loose(new Int8Array), 'Int8Array') t.ok(ista.loose(new Int16Array), 'Int16Array') t.ok(ista.loose(new Int32Array), 'Int32Array') t.ok(ista.loose(new Uint8Array), 'Uint8Array') t.ok(ista.loose(new Uint16Array), 'Uint16Array') t.ok(ista.loose(new Uint32Array), 'Uint32Array') t.ok(ista.loose(new Float32Array), 'Float32Array') t.ok(ista.loose(new Float64Array), 'Float64Array') t.ok(!ista.loose(new Array), 'Array') t.ok(!ista.loose([]), '[]') t.end() })