MCPcopy
hub / github.com/mongodb/node-mongodb-native / setMatcher

Function setMatcher

docs/3.4/js/jquery.js:2560–2651  ·  view source on GitHub ↗
( preFilter, selector, matcher, postFilter, postFinder, postSelector )

Source from the content-addressed store, hash-verified

2558}
2559
2560function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2561 if ( postFilter && !postFilter[ expando ] ) {
2562 postFilter = setMatcher( postFilter );
2563 }
2564 if ( postFinder && !postFinder[ expando ] ) {
2565 postFinder = setMatcher( postFinder, postSelector );
2566 }
2567 return markFunction(function( seed, results, context, xml ) {
2568 var temp, i, elem,
2569 preMap = [],
2570 postMap = [],
2571 preexisting = results.length,
2572
2573 // Get initial elements from seed or context
2574 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2575
2576 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2577 matcherIn = preFilter && ( seed || !selector ) ?
2578 condense( elems, preMap, preFilter, context, xml ) :
2579 elems,
2580
2581 matcherOut = matcher ?
2582 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2583 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2584
2585 // ...intermediate processing is necessary
2586 [] :
2587
2588 // ...otherwise use results directly
2589 results :
2590 matcherIn;
2591
2592 // Find primary matches
2593 if ( matcher ) {
2594 matcher( matcherIn, matcherOut, context, xml );
2595 }
2596
2597 // Apply postFilter
2598 if ( postFilter ) {
2599 temp = condense( matcherOut, postMap );
2600 postFilter( temp, [], context, xml );
2601
2602 // Un-match failing elements by moving them back to matcherIn
2603 i = temp.length;
2604 while ( i-- ) {
2605 if ( (elem = temp[i]) ) {
2606 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2607 }
2608 }
2609 }
2610
2611 if ( seed ) {
2612 if ( postFinder || preFilter ) {
2613 if ( postFinder ) {
2614 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2615 temp = [];
2616 i = matcherOut.length;
2617 while ( i-- ) {

Callers 1

matcherFromTokensFunction · 0.70

Calls 5

applyMethod · 0.80
markFunctionFunction · 0.70
multipleContextsFunction · 0.70
condenseFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected