MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / buildPath

Function buildPath

lib/html.js:239–259  ·  view source on GitHub ↗
(node, path = '')

Source from the content-addressed store, hash-verified

237}
238
239function buildPath(node, path = '') {
240 const tag = node.nodeName
241 let attributes = ''
242
243 if (node.attrs) {
244 attributes = node.attrs.map(attr => `${attr.name}="${attr.value}"`).join(' ')
245 }
246
247 if (!tag.startsWith('#') && tag !== 'body' && tag !== 'html') {
248 path += `<${node.nodeName}${node.attrs ? ` ${attributes}` : ''}>`
249 }
250
251 if (!node.childNodes) return path
252
253 const children = node.childNodes.filter(child => !child.nodeName.startsWith('#'))
254
255 if (children.length) {
256 return buildPath(children[children.length - 1], path)
257 }
258 return path
259}
260
261function splitByChunks(text, chunkSize) {
262 chunkSize -= 20

Callers 1

splitByChunksFunction · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…