1.9 KiB
1.9 KiB
isPrimitiveArray
Test if a value is an array-like object containing only JavaScript primitives.
Usage
var isPrimitiveArray = require( '@stdlib/assert/is-primitive-array' );
isPrimitiveArray( value )
Tests if a value
is an array-like object containing only JavaScript primitives.
var bool = isPrimitiveArray( [ '3', 2, null ] );
// returns true
bool = isPrimitiveArray( [ {}, 2, 1 ] );
// returns false
bool = isPrimitiveArray( [ new String( 'abc' ), '3.0' ] );
// returns false
Examples
var Number = require( '@stdlib/number/ctor' );
var isPrimitiveArray = require( '@stdlib/assert/is-primitive-array' );
var bool = isPrimitiveArray( [ '3', 2, null ] );
// returns true
bool = isPrimitiveArray( [ void 0, true ] );
// returns true
bool = isPrimitiveArray( [ new String( 'abc' ), false ] );
// returns false
bool = isPrimitiveArray( [ new Number( 2 ), null ] );
// returns false
bool = isPrimitiveArray( [ function noop() {}, null ] );
// returns false