You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
556 B
25 lines
556 B
5 years ago
|
'use strict';
|
||
|
|
||
|
/**
|
||
|
* FUNCTION: matrixLike( value )
|
||
|
* Validates if a value is matrix-like.
|
||
|
*
|
||
|
* @param {*} value - value to be validated
|
||
|
* @returns {Boolean} boolean indicating if a value is matrix-like
|
||
|
*/
|
||
|
function matrixLike( v ) {
|
||
|
return v !== null &&
|
||
|
typeof v === 'object' &&
|
||
|
typeof v.data === 'object' &&
|
||
|
typeof v.shape === 'object' &&
|
||
|
typeof v.offset === 'number' &&
|
||
|
typeof v.strides === 'object' &&
|
||
|
typeof v.dtype === 'string' &&
|
||
|
typeof v.length === 'number';
|
||
|
} // end FUNCTION matrixLike()
|
||
|
|
||
|
|
||
|
// EXPORTS //
|
||
|
|
||
|
module.exports = matrixLike;
|