MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / findModeToPattern

Function findModeToPattern

tools/xsbug/FindRow.js:44–55  ·  view source on GitHub ↗
(findMode, findString)

Source from the content-addressed store, hash-verified

42} from "behaviors";
43
44export function findModeToPattern(findMode, findString) {
45 let findPattern = findString;
46 if (findPattern) {
47 if (!(findMode & 8))
48 findPattern = findPattern.replace(/(\\|\^|\$|\.|\+|\*|\?|\(|\)|\[|\]|\{|\}|\|)/g, "\\$1");
49 if (findMode & 2)
50 findPattern = "\\b" + findPattern;
51 if (findMode & 4)
52 findPattern = findPattern + "\\b";
53 }
54 return findPattern;
55}
56
57export function findModeToCaseless(findMode) {
58 return (findMode & 1) == 0;

Callers 2

findMethod · 0.90
onFindEditedMethod · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected