MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / filterFilter

Function filterFilter

code/songhop/www/lib/angular/angular.js:16629–16655  ·  view source on GitHub ↗

* @ngdoc filter * @name filter * @kind function * * @description * Selects a subset of items from `array` and returns it as a new array. * * @param {Array} array The source array. * @param {string|Object|function()} expression The predicate to be used for selecting items from * `array`.

()

Source from the content-addressed store, hash-verified

16627 </example>
16628 */
16629function filterFilter() {
16630 return function(array, expression, comparator) {
16631 if (!isArray(array)) return array;
16632
16633 var predicateFn;
16634 var matchAgainstAnyProp;
16635
16636 switch (typeof expression) {
16637 case 'function':
16638 predicateFn = expression;
16639 break;
16640 case 'boolean':
16641 case 'number':
16642 case 'string':
16643 matchAgainstAnyProp = true;
16644 //jshint -W086
16645 case 'object':
16646 //jshint +W086
16647 predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
16648 break;
16649 default:
16650 return array;
16651 }
16652
16653 return array.filter(predicateFn);
16654 };
16655}
16656
16657// Helper functions for `filterFilter`
16658function createPredicateFn(expression, comparator, matchAgainstAnyProp) {

Callers

nothing calls this directly

Calls 1

createPredicateFnFunction · 0.70

Tested by

no test coverage detected