Skip to content

Files

Latest commit

289384c · Jan 1, 2017

History

History

is-integer-array

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 1, 2017
Nov 23, 2016
Nov 23, 2016
Nov 23, 2016
Dec 8, 2016

isIntegerArray

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

Usage

var isIntegerArray = require( '@stdlib/utils/is-integer-array' );

isIntegerArray( value )

Tests if a value is an array-like object containing only integer values.

var bool = isIntegerArray( [ -3, new Number(3) ] );
// returns true

bool = isIntegerArray( [ -3, 'abc' ] );
// returns false

isIntegerArray.primitives( value )

Tests if a value is an array-like object containing only primitive integer values.

var bool = isIntegerArray.primitives( [ -1.0, 0.0, 4.0 ] );
// returns true

bool = isIntegerArray.primitives( [ -1.0, 2.2 ] );
// returns false

bool = isIntegerArray.primitives( [ -3.0, new Number(2.0) ] );
// returns false

isIntegerArray.objects( value )

Tests if a value is an array-like object containing only Number objects holding integer values.

var bool = isIntegerArray.objects( [ new Number(-1.0), new Number(2.0) ] );
// returns true

bool = isIntegerArray.objects( [ -1.0, 0.0, 1.0 ] );
// returns false

bool = isIntegerArray.objects( [ -3.0, new Number(1.0) ] );
// returns false

Examples

var isIntegerArray = require( '@stdlib/utils/is-integer-array' );

var bool = isIntegerArray( [ -5, 0, 2, 5 ] );
// returns true

bool = isIntegerArray( [ -4, -3, 1, 3 ] );
// returns true

bool = isIntegerArray( [ -1, new Number( -6 ), 2 ] );
// returns true

bool = isIntegerArray( [ -1, 'abc', 3 ] );
// returns false

bool = isIntegerArray( [ -2.3, 0, 3 ] );
// returns false

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