MCPcopy
hub / github.com/webpack/webpack / applyNoParseRule

Method applyNoParseRule

lib/NormalModule.js:1701–1712  ·  view source on GitHub ↗

* @param {Exclude<NoParse, EXPECTED_ANY[]>} rule rule * @param {string} content content * @returns {boolean} result

(rule, content)

Source from the content-addressed store, hash-verified

1699 * @returns {boolean} result
1700 */
1701 applyNoParseRule(rule, content) {
1702 // must start with "rule" if rule is a string
1703 if (typeof rule === "string") {
1704 return content.startsWith(rule);
1705 }
1706
1707 if (typeof rule === "function") {
1708 return rule(content);
1709 }
1710 // we assume rule is a regexp
1711 return rule.test(content);
1712 }
1713
1714 /**
1715 * @param {undefined | NoParse} noParseRule no parse rule

Callers 1

shouldPreventParsingMethod · 0.95

Calls 1

testMethod · 0.45

Tested by

no test coverage detected