MCPcopy
hub / github.com/ampproject/amphtml / flattenGraph

Function flattenGraph

build-system/tasks/dep-check.js:231–239  ·  view source on GitHub ↗

* Flattens the module dependency graph and makes its entries unique. This * serves as the input on which all rules are tested. * * @param {!ModuleDef} entryPoints * @return {!ModuleDef}

(entryPoints)

Source from the content-addressed store, hash-verified

229 * @return {!ModuleDef}
230 */
231function flattenGraph(entryPoints) {
232 return flatten(entryPoints.deps).reduce((acc, cur) => {
233 const {name} = cur;
234 if (!acc[name]) {
235 acc[name] = Object.values(cur.deps);
236 }
237 return acc;
238 }, Object.create(null));
239}
240
241/**
242 * Run Module dependency graph against the rules.

Callers 1

depCheckFunction · 0.85

Calls 2

flattenFunction · 0.70
createMethod · 0.45

Tested by

no test coverage detected