1
0
Fork 0
mirror of https://github.com/YunoHost/doc.git synced 2024-09-03 20:06:26 +02:00
doc/markdownlint-rules-grav-pages/lib/flat.js
2024-03-02 04:33:13 +01:00

10 lines
247 B
JavaScript

module.exports = function flat(array) {
let result = [];
array.forEach((a) => {
result.push(a);
if (Array.isArray(a.children)) {
result = result.concat(flat(a.children));
}
});
return result;
};