Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cb();
}
return res;
});
};
};
const ifNotBlocking = function(settings) {
return settings.findBySlug('client').then(res => !res.blocking);
};
// TODO: Expose this as a env var
const cache = new Map();
// sources are 'manually' removed when closed,
// they are only closed when the usage counter is 0
const sources = new Map();
const refs = new MultiMap(Set);
export default Service.extend({
// TODO: Temporary repo list here
service: service('repository/service'),
node: service('repository/node'),
session: service('repository/session'),
client: service('client/http'),
settings: service('settings'),
// TODO: Temporary finder
finder: function(src, filter) {
const temp = src.split('/');
temp.shift();
const slug = temp.pop();
const model = temp.pop();
const dc = temp.shift();
}
}
else {
// Updating word frequency
wordFrequencies[word] = wordFrequencies[word] || 0;
wordFrequencies[word]++;
// Adding the word to the current keyword
keyword.push(word);
}
}
}
// Now we need to score the keywords and retrieve the best one
const heap = new Heap(comparator),
T = (candidateKeywords.size / 3) | 0;
candidateKeywords.forEach(keyword => {
const words = keyword.split(HASH_DELIMITER);
let score = 0;
for (let i = 0, l = words.length; i < l; i++) {
const word = words[i];
score += wordDegrees[word] / wordFrequencies[word];
}
heap.push({score, keyword: words});
if (heap.size > T)
heap.pop();
});
nearestNeighbors(k, query) {
const neighbors = new Heap(COMPARATOR),
queue = [this.root];
let tau = Infinity;
while (queue.length > 0) {
const node = queue.pop();
const d = this.distance(query, node.vantage);
if (d < tau) {
neighbors.push({distance: d, item: node.vantage});
// Trimming
if (neighbors.size > k)
neighbors.pop();
constructor(config: CacheConfig) {
super();
this._cache = new LRUMap(config.cache_size);
// @ts-ignore
this._cache.items = new BigMap(config.max_big_map_size);
}
return Object.keys(possibles).reduce((prev, key) => {
// only set the value if the value has a length of > 0
const value = typeof values[key] === 'undefined' ? [] : values[key];
if (value.length > 0) {
if (possibles[key] !== null) {
// only include possible values
prev[key] = [...setHelpers.intersection(possibles[key], new Set(value))];
} else {
// only unique values
prev[key] = [...new Set(value)];
}
}
return prev;
}, {});
};
run() {
// Building the tree
const tree = new VPTree(this.distance, this.items);
// Retrieving the clusters
const clusters = [],
visited = new Set();
for (let i = 0, l = this.items.length; i < l; i++) {
const item = this.items[i];
if (visited.has(item))
continue;
const neighbors = tree.neighbors(this.radius, item);
const cluster = new Array(neighbors.length);
for (let j = 0, m = neighbors.length; j < m; j++) {
init() {
super.init(...arguments);
cache = new Map();
sources = new Map();
usage = new MultiMap(Set);
this._listeners = this.dom.listeners();
}
if (href)
usedAssets.add(href);
});
$('img, iframe[data-internal=true]').each(function() {
const src = $(this).attr('src');
if (src)
usedAssets.add(src);
});
});
});
const allAssets = new Set(fs.readdirSync(assetsPath));
const unusedAssets = difference(allAssets, usedAssets);
const missingAssets = difference(usedAssets, allAssets);
if (missingAssets.size)
console.warning('Missing assets!', missingAssets);
return unusedAssets;
};
if (href)
usedAssets.add(href);
});
$('img, iframe[data-internal=true]').each(function() {
const src = $(this).attr('src');
if (src)
usedAssets.add(src);
});
});
});
const allAssets = new Set(fs.readdirSync(assetsPath));
const unusedAssets = difference(allAssets, usedAssets);
const missingAssets = difference(usedAssets, allAssets);
if (missingAssets.size)
console.warning('Missing assets!', missingAssets);
return unusedAssets;
};
source: (item, values) => {
return setHelpers.intersectionSize(values, new Set(item.ExternalSources || [])) !== 0;
},
};