Skip to content

Latest commit

 

History

History

is-primitive-array

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

isPrimitiveArray

Test if a value is an array-like object containing only JavaScript primitives.

Usage

var isPrimitiveArray = require( '@stdlib/utils/is-primitive' );

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 isPrimitiveArray = require( '@stdlib/utils/is-primitive-array' );

var bool = isPrimitiveArray( [ '3', 2, null ] );
// returns true

bool = isPrimitiveArray( [ undefined, true ] );
// returns true

bool = isPrimitiveArray( [ new String( 'abc' ), false ] );
// returns false

bool = isPrimitiveArray( [ new Number( 2 ), null ] );
// returns false

bool = isPrimitiveArray( [ function(){}, null ] );
// returns false