MCPcopy Create free account
hub / github.com/adobe/react-spectrum / match

Function match

packages/dev/parcel-transformer-mdx-docs/MDXFragments.js:39–60  ·  view source on GitHub ↗
(children, i, ...texts)

Source from the content-addressed store, hash-verified

37 });
38
39function match(children, i, ...texts) {
40 if (children.length < i + texts.length) {
41 return false;
42 }
43
44 for (let t = 0; t < texts.length; t++, i++) {
45 let text = texts[t];
46 let child = children[i];
47
48 if (child.type === 'element') {
49 if (child.children && child.children[0] && child.children[0].value !== text) {
50 return false;
51 }
52 } else if (child.type === 'text') {
53 if (child.value !== text) {
54 return false;
55 }
56 }
57 }
58
59 return true;
60}
61
62/**
63 * This undoes the above wrapping for display purposes.

Callers 1

fragmentUnWrapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected