Skip to content

Latest commit

 

History

History

is-matrix-like

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

isMatrixLike

Test if a value is matrix-like.

Usage

var isMatrixLike = require( '@stdlib/assert/is-matrix-like' );

isMatrixLike( value )

Tests if a value is matrix-like.

var Int8Array = require( '@stdlib/array/int8' );

var mat = {
    'data': new Int8Array( 10 ),
    'shape': [ 5, 2 ],
    'offset': 0,
    'strides': [ 2, 1 ],
    'dtype': 'int8',
    'length': 10
};

console.log( isMatrixLike( mat ) );
// returns true

Examples

var Int8Array = require( '@stdlib/array/int8' );
var isMatrixLike = require( '@stdlib/assert/is-matrix-like' );

var mat = {
    'data': new Int8Array( 10 ),
    'shape': [ 5, 2 ],
    'offset': 0,
    'strides': [ 2, 1 ],
    'dtype': 'int8',
    'length': 10
};
console.log( isMatrixLike( mat ) );
// returns true

console.log( isMatrixLike( [] ) );
// returns false

console.log( isMatrixLike( {} ) );
// returns false

console.log( isMatrixLike( null ) );
// returns false