MCPcopy Index your code
hub / github.com/github/docs / assertUniqueChildren

Function assertUniqueChildren

lib/create-tree.js:61–71  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

59}
60
61function assertUniqueChildren(page) {
62 if (page.children.length !== new Set(page.children).size) {
63 const count = {}
64 page.children.forEach((entry) => (count[entry] = 1 + (count[entry] || 0)))
65 let msg = `${page.relativePath} has duplicates in the 'children' key.`
66 for (const [entry, times] of Object.entries(count)) {
67 if (times > 1) msg += ` '${entry}' is repeated ${times} times. `
68 }
69 throw new Error(msg)
70 }
71}

Callers 1

createTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected