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

14 lines
365 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
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)))
}