MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / adjustMatcher

Function adjustMatcher

lib/test/angular/1.6.7/angular.js:19067–19092  ·  view source on GitHub ↗
(matcher)

Source from the content-addressed store, hash-verified

19065}
19066
19067function adjustMatcher(matcher) {
19068 if (matcher === 'self') {
19069 return matcher;
19070 } else if (isString(matcher)) {
19071 // Strings match exactly except for 2 wildcards - '*' and '**'.
19072 // '*' matches any character except those from the set ':/.?&'.
19073 // '**' matches any character (like .* in a RegExp).
19074 // More than 2 *'s raises an error as it's ill defined.
19075 if (matcher.indexOf('***') > -1) {
19076 throw $sceMinErr('iwcard',
19077 'Illegal sequence *** in string matcher. String: {0}', matcher);
19078 }
19079 matcher = escapeForRegexp(matcher).
19080 replace(/\\\*\\\*/g, '.*').
19081 replace(/\\\*/g, '[^:/.?&;]*');
19082 return new RegExp('^' + matcher + '$');
19083 } else if (isRegExp(matcher)) {
19084 // The only other type of matcher allowed is a Regexp.
19085 // Match entire URL / disallow partial matches.
19086 // Flags are reset (i.e. no global, ignoreCase or multiline)
19087 return new RegExp('^' + matcher.source + '$');
19088 } else {
19089 throw $sceMinErr('imatcher',
19090 'Matchers may only be "self", string patterns or RegExp objects');
19091 }
19092}
19093
19094
19095function adjustMatchers(matchers) {

Callers 1

adjustMatchersFunction · 0.70

Calls 3

isStringFunction · 0.70
escapeForRegexpFunction · 0.70
isRegExpFunction · 0.70

Tested by

no test coverage detected