isPlainObjectArray

Test if a value is an array-like object containing only plain objects.

Usage

var isPlainObjectArray = require( '@stdlib/assert/is-plain-object-array' );

isPlainObjectArray( value )

Tests if a value is an array-like object containing only plain objects.

var Number = require( '@stdlib/number/ctor' );

var bool = isPlainObjectArray( [ {}, { 'beep': 'boop' } ] );
// returns true

bool = isPlainObjectArray( [ {}, new Number(3.0) ] );
// returns false

bool = isPlainObjectArray( [ {}, '3.0' ] );
// returns false

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

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

Examples

var Number = require( '@stdlib/number/ctor' );
var isPlainObjectArray = require( '@stdlib/assert/is-plain-object-array' );

var bool = isPlainObjectArray( [ { 'beep': 'boop' }, {}, {} ] );
// returns true

bool = isPlainObjectArray( [ new Date(), new Number( 3 ) ] );
// returns false

bool = isPlainObjectArray( [ {}, new String( 'abc' ), {} ] );
// returns false

bool = isPlainObjectArray( [ [], {} ] );
// returns false

bool = isPlainObjectArray( [ 'a', 'b' ] );
// returns false

bool = isPlainObjectArray( [] );
// returns false
Did you find this page helpful?