MCPcopy
hub / github.com/webpack/webpack / getSimilarities

Function getSimilarities

lib/util/deterministicGrouping.js:287–300  ·  view source on GitHub ↗
(nodes)

Source from the content-addressed store, hash-verified

285 * @returns {Similarities} similarities
286 */
287const getSimilarities = (nodes) => {
288 // calculate similarities between lexically adjacent nodes
289 /** @type {Similarities} */
290 const similarities = [];
291 /** @type {undefined | Node<T>} */
292 let last;
293 for (const node of nodes) {
294 if (last !== undefined) {
295 similarities.push(similarity(last.key, node.key));
296 }
297 last = node;
298 }
299 return similarities;
300};
301
302/**
303 * Defines the shared type used by this module.

Callers 1

Calls 2

similarityFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected