"use strict" var ndarray = require("ndarray") var do_convert = require("./doConvert.js") module.exports = function convert(arr, result) { var shape = [], c = arr, sz = 1 while(Array.isArray(c)) { shape.push(c.length) sz *= c.length c = c[0] } if(shape.length === 0) { return ndarray() } if(!result) { result = ndarray(new Float64Array(sz), shape) } do_convert(result, arr) return result }