NarrativeFlow / static /node_modules /mongoose /lib /helpers /model /pushNestedArrayPaths.js
kaab4321's picture
first
9756872
Raw
History Blame Contribute Delete
353 Bytes
'use strict';
module.exports = function pushNestedArrayPaths(paths, nestedArray, path) {
if (nestedArray == null) {
return;
}
for (let i = 0; i < nestedArray.length; ++i) {
if (Array.isArray(nestedArray[i])) {
pushNestedArrayPaths(paths, nestedArray[i], path + '.' + i);
} else {
paths.push(path + '.' + i);
}
}
};