is-boxed-primitive

1.0.1 • Public • Published

is-boxed-primitive Version Badge

dependency status dev dependency status License Downloads

npm badge

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

Package Sidebar

Install

npm i is-boxed-primitive

Weekly Downloads

42

Version

1.0.1

License

MIT

Unpacked Size

11.7 kB

Total Files

12

Last publish

Collaborators

  • ljharb