codeql-action/node_modules/unbox-primitive
Henry Mercer ed9506bbaf Bump `eslint-plugin-import` to avoid vulnerability in dependency 2023-01-18 21:00:05 +00:00
..
.github Update checked-in dependencies 2021-07-27 16:54:26 +00:00
test Update checked-in dependencies 2021-07-27 16:54:26 +00:00
.editorconfig Update checked-in dependencies 2021-07-27 16:54:26 +00:00
.eslintrc Update checked-in dependencies 2021-07-27 16:54:26 +00:00
.nycrc Update checked-in dependencies 2021-07-27 16:54:26 +00:00
CHANGELOG.md Bump `eslint-plugin-import` to avoid vulnerability in dependency 2023-01-18 21:00:05 +00:00
LICENSE Update checked-in dependencies 2021-07-27 16:54:26 +00:00
README.md Bump `eslint-plugin-import` to avoid vulnerability in dependency 2023-01-18 21:00:05 +00:00
index.js Bump `eslint-plugin-import` to avoid vulnerability in dependency 2023-01-18 21:00:05 +00:00
package.json Bump `eslint-plugin-import` to avoid vulnerability in dependency 2023-01-18 21:00:05 +00:00

README.md

unbox-primitive Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Unbox a boxed JS primitive value. This module works cross-realm/iframe, does not depend on instanceof or mutable properties, and works despite ES6 Symbol.toStringTag.

Example

var unboxPrimitive = require('unbox-primitive');
var assert = require('assert');

assert.equal(unboxPrimitive(new Boolean(false)), false);
assert.equal(unboxPrimitive(new String('f')), 'f');
assert.equal(unboxPrimitive(new Number(42)), 42);
const s = Symbol();
assert.equal(unboxPrimitive(Object(s)), s);
assert.equal(unboxPrimitive(new BigInt(42)), 42n);

// any primitive, or non-boxed-primitive object, will throw

Tests

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