A suite to track Project Diva score statistics and ratings / D4DJ event data.
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.
projectdivar/server/node_modules/ndarray-pack/convert.js

22 lines
429 B

"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
}