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

Function createPredicateFn

code/songhop/www/lib/angular/angular.js:16658–16681  ·  view source on GitHub ↗
(expression, comparator, matchAgainstAnyProp)

Source from the content-addressed store, hash-verified

16656
16657// Helper functions for `filterFilter`
16658function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
16659 var predicateFn;
16660
16661 if (comparator === true) {
16662 comparator = equals;
16663 } else if (!isFunction(comparator)) {
16664 comparator = function(actual, expected) {
16665 if (isObject(actual) || isObject(expected)) {
16666 // Prevent an object to be considered equal to a string like `'[object'`
16667 return false;
16668 }
16669
16670 actual = lowercase('' + actual);
16671 expected = lowercase('' + expected);
16672 return actual.indexOf(expected) !== -1;
16673 };
16674 }
16675
16676 predicateFn = function(item) {
16677 return deepCompare(item, expression, comparator, matchAgainstAnyProp);
16678 };
16679
16680 return predicateFn;
16681}
16682
16683function deepCompare(actual, expected, comparator, matchAgainstAnyProp) {
16684 var actualType = typeof actual;

Callers 1

filterFilterFunction · 0.70

Calls 4

isFunctionFunction · 0.70
isObjectFunction · 0.70
lowercaseFunction · 0.70
deepCompareFunction · 0.70

Tested by

no test coverage detected