Bolshakova Anna ab21a11190 lab | 3 周之前 | |
---|---|---|
.. | ||
.github | 3 周之前 | |
test | 3 周之前 | |
.editorconfig | 3 周之前 | |
.eslintrc | 3 周之前 | |
.nycrc | 3 周之前 | |
CHANGELOG.md | 3 周之前 | |
LICENSE | 3 周之前 | |
README.md | 3 周之前 | |
index.d.ts | 3 周之前 | |
index.js | 3 周之前 | |
package.json | 3 周之前 | |
tsconfig.json | 3 周之前 |
Is this value a JS DataView? This module works cross-realm/iframe, does not depend on instanceof
or mutable properties, and despite ES6 Symbol.toStringTag.
var isDataView = require('is-data-view');
var assert = require('assert');
assert.equal(false, isDataView(undefined));
assert.equal(false, isDataView(null));
assert.equal(false, isDataView(false));
assert.equal(false, isDataView(true));
assert.equal(false, isDataView([]));
assert.equal(false, isDataView({}));
assert.equal(false, isDataView(/a/g));
assert.equal(false, isDataView(new RegExp('a', 'g')));
assert.equal(false, isDataView(new Date()));
assert.equal(false, isDataView(42));
assert.equal(false, isDataView(NaN));
assert.equal(false, isDataView(Infinity));
assert.equal(false, isDataView(new Number(42)));
assert.equal(false, isDataView('foo'));
assert.equal(false, isDataView(Object('foo')));
assert.equal(false, isDataView(function () {}));
assert.equal(false, isDataView(function* () {}));
assert.equal(false, isDataView(x => x * x));
assert.equal(false, isDataView([]));
assert.equal(false, isDataView(new Int8Array()));
assert.equal(false, isDataView(new Uint8Array()));
assert.equal(false, isDataView(new Uint8ClampedArray()));
assert.equal(false, isDataView(new Int16Array()));
assert.equal(false, isDataView(new Uint16Array()));
assert.equal(false, isDataView(new Int32Array()));
assert.equal(false, isDataView(new Uint32Array()));
assert.equal(false, isDataView(new Float32Array()));
assert.equal(false, isDataView(new Float64Array()));
assert.equal(false, isDataView(new BigInt64Array()));
assert.equal(false, isDataView(new BigUint64Array()));
assert.ok(isDataView(new DataView(new ArrayBuffer(0))));
Simply clone the repo, npm install
, and run npm test