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

Function adjustMatcher

lib/test/angular/1.4.3/angular.js:16348–16373  ·  view source on GitHub ↗
(matcher)

Source from the content-addressed store, hash-verified

16346// Helper functions follow.
16347
16348function adjustMatcher(matcher) {
16349 if (matcher === 'self') {
16350 return matcher;
16351 } else if (isString(matcher)) {
16352 // Strings match exactly except for 2 wildcards - '*' and '**'.
16353 // '*' matches any character except those from the set ':/.?&'.
16354 // '**' matches any character (like .* in a RegExp).
16355 // More than 2 *'s raises an error as it's ill defined.
16356 if (matcher.indexOf('***') > -1) {
16357 throw $sceMinErr('iwcard',
16358 'Illegal sequence *** in string matcher. String: {0}', matcher);
16359 }
16360 matcher = escapeForRegexp(matcher).
16361 replace('\\*\\*', '.*').
16362 replace('\\*', '[^:/.?&;]*');
16363 return new RegExp('^' + matcher + '$');
16364 } else if (isRegExp(matcher)) {
16365 // The only other type of matcher allowed is a Regexp.
16366 // Match entire URL / disallow partial matches.
16367 // Flags are reset (i.e. no global, ignoreCase or multiline)
16368 return new RegExp('^' + matcher.source + '$');
16369 } else {
16370 throw $sceMinErr('imatcher',
16371 'Matchers may only be "self", string patterns or RegExp objects');
16372 }
16373}
16374
16375
16376function adjustMatchers(matchers) {

Callers 1

adjustMatchersFunction · 0.70

Calls 3

isStringFunction · 0.70
escapeForRegexpFunction · 0.70
isRegExpFunction · 0.70

Tested by

no test coverage detected