time-to-botec/js/node_modules/@stdlib/assert/is-primitive
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

isPrimitive

Test if a value is a JavaScript primitive.

Usage

var isPrimitive = require( '@stdlib/assert/is-primitive' );

isPrimitive( value )

Tests if a value is a JavaScript primitive.

var bool = isPrimitive( false );
// returns true

Notes

  • Seven primitives:

    • string
    • number
    • boolean
    • null
    • undefined
    • symbol (ES6/ES2015)
    • bigint (ES11/ES2020)

Examples

var isPrimitive = require( '@stdlib/assert/is-primitive' );

var bool = isPrimitive( false );
// returns true

bool = isPrimitive( 0 );
// returns true

bool = isPrimitive( '' );
// returns true

bool = isPrimitive( null );
// returns true

bool = isPrimitive( void 0 );
// returns true

bool = isPrimitive( [] );
// returns false

bool = isPrimitive( {} );
// returns false

bool = isPrimitive( function noop() {} );
// returns false

bool = isPrimitive( new Boolean() );
// returns false

bool = isPrimitive( new String() );
// returns false

bool = isPrimitive( new Array() );
// returns false

bool = isPrimitive( new Object() );
// returns false