MCPcopy Index your code
hub / github.com/refined-github/refined-github / assertNodeContent

Function assertNodeContent

source/helpers/dom-utils.ts:94–102  ·  view source on GitHub ↗
(node: Nullable<N>, expectation: RegExp | string)

Source from the content-addressed store, hash-verified

92};
93
94export const assertNodeContent = <N extends Text | ChildNode>(node: Nullable<N>, expectation: RegExp | string): N => {
95 if (isTextNodeContaining(node, expectation)) {
96 return node!;
97 }
98
99 console.warn('Expected node:', node!.parentElement);
100 const content = node!.textContent.trim();
101 throw new Error(`Expected node matching ${escapeMatcher(expectation)}, found ${escapeMatcher(content)}`);
102};
103
104export const removeTextNodeContaining = (node: Text | ChildNode, expectation: RegExp | string): void => {
105 assertNodeContent(node, expectation);

Callers 8

removeTextNodeContainingFunction · 0.85
removeTextInTextNodeFunction · 0.85
replaceFromWithArrowFunction · 0.85
addConversationLinksFunction · 0.85
addCountsFunction · 0.85
linkifyFunction · 0.85
replaceCheckboxesFunction · 0.85
hideLanguageHeaderFunction · 0.85

Calls 2

isTextNodeContainingFunction · 0.85
escapeMatcherFunction · 0.85

Tested by

no test coverage detected