inspect-js / is-boxed-primitive

Polyfill/shim for node's `util.types.isBoxedPrimitive()`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-boxed-primitive Version Badge

github actions coverage 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

About

Polyfill/shim for node's `util.types.isBoxedPrimitive()`

License:MIT License


Languages

Language:JavaScript 100.0%