MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / filterFilter

Function filterFilter

OpenReservation/wwwroot/Scripts/angular.js:19767–19801  ·  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 sele

()

Source from the content-addressed store, hash-verified

19765 </example>
19766 */
19767 function filterFilter() {
19768 return function (array, expression, comparator) {
19769 if (!isArrayLike(array)) {
19770 if (array == null) {
19771 return array;
19772 } else {
19773 throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
19774 }
19775 }
19776
19777 var expressionType = getTypeForFilter(expression);
19778 var predicateFn;
19779 var matchAgainstAnyProp;
19780
19781 switch (expressionType) {
19782 case 'function':
19783 predicateFn = expression;
19784 break;
19785 case 'boolean':
19786 case 'null':
19787 case 'number':
19788 case 'string':
19789 matchAgainstAnyProp = true;
19790 //jshint -W086
19791 case 'object':
19792 //jshint +W086
19793 predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);
19794 break;
19795 default:
19796 return array;
19797 }
19798
19799 return Array.prototype.filter.call(array, predicateFn);
19800 };
19801 }
19802
19803 // Helper functions for `filterFilter`
19804 function createPredicateFn(expression, comparator, matchAgainstAnyProp) {

Callers

nothing calls this directly

Calls 4

isArrayLikeFunction · 0.85
minErrFunction · 0.85
getTypeForFilterFunction · 0.85
createPredicateFnFunction · 0.85

Tested by

no test coverage detected