nlu
Version:
Use this package to link your projects together for local development.
20 lines (19 loc) • 644 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCleanMap = function (rootPackageName, map) {
const newMap = {};
const getRelevantItems = function (v) {
if (map[v] && !newMap[v]) {
newMap[v] = map[v];
const list = map[v].deps;
if (!Array.isArray(list)) {
throw new Error('list should be an array, but is not an array type: ' + JSON.stringify(map[v]));
}
list.forEach(function (l) {
getRelevantItems(l);
});
}
};
getRelevantItems(rootPackageName);
return newMap;
};