MCPcopy Index your code
hub / github.com/documentcloud/visualsearch / condense

Function condense

build-min/dependencies.js:123–124  ·  view source on GitHub ↗
(unmatched,map,filter,context,xml)

Source from the content-addressed store, hash-verified

121function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false;}}
122return true;}:matchers[0];}
123function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if((elem=unmatched[i])){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i);}}}}
124return newUnmatched;}
125function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter);}
126if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector);}
127return markFunction(function(seed,results,context,xml){var temp,i,elem,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems,matcherOut=matcher?postFinder||(seed?preFilter:preexisting||postFilter)?[]:results:matcherIn;if(matcher){matcher(matcherIn,matcherOut,context,xml);}

Callers 2

setMatcherFunction · 0.85
superMatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected