Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

unbox-primitive

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

unbox-primitive

Unbox a boxed JS primitive value.

    1.0.2latest

Version published
Maintainers
1
Weekly downloads
24,284,976

Weekly downloads

Changelog

Source

v1.0.2 - 2022-04-24

Commits

Readme

Source

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

Keywords

FAQs

What is unbox-primitive?

Unbox a boxed JS primitive value.

Is unbox-primitive popular?

The npm package unbox-primitive receives a total of 21,042,170 weekly downloads. As such, unbox-primitive popularity was classified as popular.

Is unbox-primitive well maintained?

We found that unbox-primitive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 25 Apr 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc