Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(store, options) {
options = options || {};
const pathPrefix = options.pathPrefix || '';
const skipDrafts = options.skipDrafts || false;
const draftIds = new Set();
this.store = store;
this.graph = new Graph();
// Hydrating graph & filtering drafts
models.forEach(model => {
store[model] = store[model].filter(item => {
if (skipDrafts && item.draft) {
draftIds.add(item.id);
return false;
}
// Tagging model
item.model = model;
this.graph.addNode(item.id);
return true;
});
});