isComplexTypedArrayLike

Test if a value is complex-typed-array-like.

Usage

var isComplexTypedArrayLike = require( '@stdlib/assert/is-complex-typed-array-like' );

isComplexTypedArrayLike( value )

Tests if a value is complex-typed-array-like.

var Complex64Array = require( '@stdlib/array/complex64' );

var bool = isComplexTypedArrayLike( new Complex64Array() );
// returns true

bool = isComplexTypedArrayLike({
    'length': 10,
    'byteOffset': 0,
    'byteLength': 10,
    'BYTES_PER_ELEMENT': 4,
    'get': function get() {},
    'set': function set() {}
});
// returns true

Examples

var Complex64Array = require( '@stdlib/array/complex64' );
var isComplexTypedArrayLike = require( '@stdlib/assert/is-complex-typed-array-like' );

var bool;
var arr;

arr = {
    'BYTES_PER_ELEMENT': 8,
    'length': 10,
    'byteOffset': 0,
    'byteLength': 10,
    'get': function get() {},
    'set': function set() {}
};
bool = isComplexTypedArrayLike( arr );
// returns true

bool = isComplexTypedArrayLike( new Complex64Array( 4 ) );
// returns true

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

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

bool = isComplexTypedArrayLike( null );
// returns false

bool = isComplexTypedArrayLike( 'beep' );
// returns false

bool = isComplexTypedArrayLike( function foo( a, b ) {} );
// returns false
Did you find this page helpful?