MCPcopy
hub / github.com/webpack/webpack / uniqueArray

Function uniqueArray

lib/stats/DefaultStatsFactoryPlugin.js:373–382  ·  view source on GitHub ↗
(items, selector)

Source from the content-addressed store, hash-verified

371 * @returns {I[]} array of values
372 */
373const uniqueArray = (items, selector) => {
374 /** @type {Set<I>} */
375 const set = new Set();
376 for (const item of items) {
377 for (const i of selector(item)) {
378 set.add(i);
379 }
380 }
381 return [...set];
382};
383
384/**
385 * Unique ordered array.

Callers 2

uniqueOrderedArrayFunction · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected