-
Notifications
You must be signed in to change notification settings - Fork 0
/
bam-filtering.min.js
13 lines (11 loc) · 1.38 KB
/
bam-filtering.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
* @license MIT License, http://www.opensource.org/licenses/MIT
* @version v0.0.1 - 2014-10-14
* An array of filters that support nested heavly nested attributes
* @link https://github.com/a8m/angular-filter
* @author Joshua S. Github: Naysayer
* Brought to you by Blast Analytics and Marketing
*/
(function(l,f,m){function h(a){var b=Array.prototype.slice.call(arguments),b=[].concat.apply([],b);a=b.shift();for(var c=0;c<b.length;c++){if(!a||!a.hasOwnProperty(b[c]))return!1;a=a[b[c]]}return!0}function d(a){var b=Array.prototype.slice.call(arguments),b=[].concat.apply([],b);a=b.shift();for(var c=0;c<b.length;c++)a=a[b[c]];return a}function g(a){return function(b,c,e){e=parseFloat(e);return"number"==typeof e&&isNaN(e)?b:k(b,c,e,a)}}function k(a,b,c,e){var d=[];f.forEach(a,function(a){h(a,b)&&
e(a,b,c)&&d.push(a)});return d}f.module("bam.numericalComparisonFilters",[]).filter("bamGreaterThan",function(){return g(function(a,b,c){return d(a,b)>c})}).filter("bamLessThan",function(){return g(function(a,b,c){return d(a,b)<c})});f.module("bam.wordCountFilters",[]).filter("bamWordCountGreaterThan",function(){return g(function(a,b,c){return String(d(a,b)).split(" ").length>c})}).filter("bamWordCountLessThan",function(){return g(function(a,b,c){return String(d(a,b)).split(" ").length<c})});f.module("bam.filtering",
["bam.numericalComparisonFilters","bam.wordCountFilters"])})(window,window.angular);