| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 1x 4x 4x 8x 11x 11x 4x 7x 4x 4x 1x | 'use strict';
const Path = require('path');
const isObject = require('lodash/isObject');
const shrinkPaths = (basePath, pathsHash) => {
const paths = [];
const shrink = (path, hash) => {
Object.keys(hash).forEach(key => {
const newPath = Path.join(path, key);
if (isObject(hash[key])) {
return shrink(newPath, hash[key]);
}
paths.push(newPath);
});
};
shrink(basePath, pathsHash);
return paths;
};
module.exports = shrinkPaths;
|