is-boxed-primitive
v1.0.1
Published
Is this value a boxed primitive? Shim for node's util.isBoxedPrimitive.
Downloads
815
Maintainers
Readme
is-boxed-primitive
Polyfill/shim for node's util.isBoxedPrimitive()
Example
var isBoxedPrimitive = require('is-boxed-primitive');
var assert = require('assert');
[
undefined,
null,
true,
false,
0,
NaN,
Infinity,
0n,
'',
'foo',
Symbol(),
Symbol.iterator,
].forEach((v) => {
assert(!isBoxedPrimitive(v)); // primitive form is not boxed
if (v != null) {
assert(isBoxedPrimitive(Object(v))); // object form is boxed
}
});
Tests
Simply clone the repo, npm install
, and run npm test