in pytheas-core/src/main/resources/js/form2js/js2form.js [247:281]
function object2array(obj, lvl)
{
var result = [], i, name;
if (arguments.length == 1) lvl = 0;
if (obj == null)
{
result = [{ name: "", value: null }];
}
else if (typeof obj == 'string' || typeof obj == 'number' || typeof obj == 'date' || typeof obj == 'boolean')
{
result = [
{ name: "", value : obj }
];
}
else if (obj instanceof Array)
{
for (i = 0; i < obj.length; i++)
{
name = "[" + i + "]";
result = result.concat(getSubValues(obj[i], name, lvl + 1));
}
}
else
{
for (i in obj)
{
name = i;
result = result.concat(getSubValues(obj[i], name, lvl + 1));
}
}
return result;
}