securityos/node_modules/regl/lib/util/is-ndarray.js

14 lines
365 B
JavaScript

var isTypedArray = require('./is-typed-array')
module.exports = function isNDArrayLike (obj) {
return (
!!obj &&
typeof obj === 'object' &&
Array.isArray(obj.shape) &&
Array.isArray(obj.stride) &&
typeof obj.offset === 'number' &&
obj.shape.length === obj.stride.length &&
(Array.isArray(obj.data) ||
isTypedArray(obj.data)))
}