Skip to content

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

License

Notifications You must be signed in to change notification settings

inspect-js/is-boxed-primitive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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