MCPcopy Index your code
hub / github.com/angular-ui/ui-router / search

Function search

test/angular/1.2/angular.js:14978–15010  ·  view source on GitHub ↗
(obj, text)

Source from the content-addressed store, hash-verified

14976 }
14977
14978 var search = function(obj, text){
14979 if (typeof text === 'string' && text.charAt(0) === '!') {
14980 return !search(obj, text.substr(1));
14981 }
14982 switch (typeof obj) {
14983 case 'boolean':
14984 case 'number':
14985 case 'string':
14986 return comparator(obj, text);
14987 case 'object':
14988 switch (typeof text) {
14989 case 'object':
14990 return comparator(obj, text);
14991 default:
14992 for ( var objKey in obj) {
14993 if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) {
14994 return true;
14995 }
14996 }
14997 break;
14998 }
14999 return false;
15000 case 'array':
15001 for ( var i = 0; i < obj.length; i++) {
15002 if (search(obj[i], text)) {
15003 return true;
15004 }
15005 }
15006 return false;
15007 default:
15008 return false;
15009 }
15010 };
15011 switch (typeof expression) {
15012 case 'boolean':
15013 case 'number':

Callers 1

filterFilterFunction · 0.85

Calls 1

comparatorFunction · 0.70

Tested by

no test coverage detected