1.1.15 • Published 1 month ago

which-typed-array v1.1.15

Weekly downloads
1,699,461
License
MIT
Repository
github
Last release
1 month ago

which-typed-array Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Which kind of Typed Array is this JavaScript value? Works cross-realm, without instanceof, and despite Symbol.toStringTag.

Example

var whichTypedArray = require('which-typed-array');
var assert = require('assert');

assert.equal(false, whichTypedArray(undefined));
assert.equal(false, whichTypedArray(null));
assert.equal(false, whichTypedArray(false));
assert.equal(false, whichTypedArray(true));
assert.equal(false, whichTypedArray([]));
assert.equal(false, whichTypedArray({}));
assert.equal(false, whichTypedArray(/a/g));
assert.equal(false, whichTypedArray(new RegExp('a', 'g')));
assert.equal(false, whichTypedArray(new Date()));
assert.equal(false, whichTypedArray(42));
assert.equal(false, whichTypedArray(NaN));
assert.equal(false, whichTypedArray(Infinity));
assert.equal(false, whichTypedArray(new Number(42)));
assert.equal(false, whichTypedArray('foo'));
assert.equal(false, whichTypedArray(Object('foo')));
assert.equal(false, whichTypedArray(function () {}));
assert.equal(false, whichTypedArray(function* () {}));
assert.equal(false, whichTypedArray(x => x * x));
assert.equal(false, whichTypedArray([]));

assert.equal('Int8Array', whichTypedArray(new Int8Array()));
assert.equal('Uint8Array', whichTypedArray(new Uint8Array()));
assert.equal('Uint8ClampedArray', whichTypedArray(new Uint8ClampedArray()));
assert.equal('Int16Array', whichTypedArray(new Int16Array()));
assert.equal('Uint16Array', whichTypedArray(new Uint16Array()));
assert.equal('Int32Array', whichTypedArray(new Int32Array()));
assert.equal('Uint32Array', whichTypedArray(new Uint32Array()));
assert.equal('Float32Array', whichTypedArray(new Float32Array()));
assert.equal('Float64Array', whichTypedArray(new Float64Array()));
assert.equal('BigInt64Array', whichTypedArray(new BigInt64Array()));
assert.equal('BigUint64Array', whichTypedArray(new BigUint64Array()));

Tests

Simply clone the repo, npm install, and run npm test

es-abstractutildeep-equaltraverseis-typed-arrayarchetype-libraryeasy-select-rn@phil8795/pecuniarius-apicogoportutilsquoc-test@infinitebrahmanuniverse/nolb-whi@saaspe/componentsexpand-react-bridgeopea-bootstraapluminos-ui-coresklif-ui-kitsklif-apijawwy-sdkjawwy_gamification_release@everything-registry/sub-chunk-3144@deepakorg/test@deepak757/testreact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablesklif-uimachinebeemrcapsreact-native-jawwy_sample@eki-group/svelvet@jet2/ui-library@genexus/ngx-aws-deploy@gericuz/tea-fairly@kandelvijaya/homebridge-philipsair-platform@knooks/use-title@lxxtea/teababibikinpusing@lehuyaa/my-assets@juanaraneta/dept-central-lib-clientjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwynextjs-storiestest_lib_module_aarzzzxxxyyy321123@innoswap/core@mayuriachewad/pickupbiz-npm-package@max_alieksieiev/react-pdf-viewer-root@mihai.stanica/stanikione@mihai.stanica/stanikitwo@maxxim/mxmils@parallelnft/web3modal@npm_fluentco/adflow-react-native-sdk@podlubnaja/ui-kit@qandq/plugins-common@rahulkumaran/hello-rahulinquas@namtoonix/editorjs-custom-multiple-selected@newtonsander/util@nirin100/quadratic-protocol@nirin100/quadratic-sdk@nodeberry/solidity-payment-processor@epigraph/epigraph-analytics@girhan/moko@gjsify/util@fabwcie/ckeditor5-preview@extrieve_technologies/quickcapture_react_native@nyaxk/react-one-tab-enforcer@nyanator/chrome-ext-utils@object-studio/react-native-web@navabi/react-native-ssl-pinning@react-18-pdf/root@react-native-ui-design/buttonkloso@sudophunk/v4-client@sudophunk/fulido@stunned/svelte-previouskintilidin15@teapucuk46/azumietea66lembah1letsgoobraderletherego932leonardsinggihtea46react-native-login-demo-test@thuromun/thurotea@thinxviewx/core-rn@techdacxi/capacitor-persona-plugin@titani0us/airbrakeliulasdnflsfd_ethgastool@icetee/react-recaptcha-v3@img-arena/img-ui-mui-theme@img-arena/ui-core@imrtoy/homebridge-night-light@jabatoforever/react-tw-datepicker@idas1/ui-component-lib@ifanshx/cycgods@joaquinmr99/calculadora@jleiva/signer-jwt
1.1.15

1 month ago

1.1.14

2 months ago

1.1.12

6 months ago

1.1.13

6 months ago

1.1.11

9 months ago

1.1.10

9 months ago

1.1.9

1 year ago

1.1.8

2 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.1

8 years ago

1.0.0

9 years ago