MCPcopy Create free account
hub / github.com/Thinkmill/react-markings / validate

Function validate

index.js:29–58  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

27}
28
29function validate(node) {
30 var isValid = true;
31 var walker = node.walker();
32 var event;
33
34 while ((event = walker.next())) {
35 var node = event.node;
36
37 if (!event.entering || !node.literal) {
38 continue;
39 }
40
41 if (node.literal.indexOf(PLACEHOLDER) === -1) {
42 continue;
43 }
44
45 if (
46 node.type === 'text' &&
47 node.parent.type === 'paragraph' &&
48 node.literal === PLACEHOLDER
49 ) {
50 continue;
51 }
52
53 isValid = false;
54 break;
55 }
56
57 return isValid;
58}
59
60/*::
61declare type ReactNode =

Callers 1

customizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected