Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-filter-pipe

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-filter-pipe - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

146

bundles/ngx-filter-pipe.umd.js

@@ -15,2 +15,33 @@ (function (global, factory) {

/**
* @param {?} value
* @param {?} key
* @return {?}
*/
FilterPipe.isFoundOnWalking = function (value, key) {
var /** @type {?} */ walker = value;
var /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
return found;
};
/**
* @param {?} value
* @return {?}
*/
FilterPipe.isNumber = function (value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
};
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
FilterPipe.getValue = function (value) {
return typeof value === 'function' ? value() : value;
};
/**
* @param {?} filter

@@ -23,5 +54,3 @@ * @return {?}

}
return function (value) {
return !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false);
};
return function (value) { return !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false); };
};

@@ -33,5 +62,3 @@ /**

FilterPipe.prototype.filterByBoolean = function (filter) {
return function (value) {
return Boolean(value) === filter;
};
return function (value) { return Boolean(value) === filter; };
};

@@ -47,3 +74,3 @@ /**

if (key === '$or') {
if (!_this.filterByOr(filter.$or)(_this.getValue(value))) {
if (!_this.filterByOr(filter.$or)(FilterPipe.getValue(value))) {
return false;

@@ -53,29 +80,6 @@ }

}
var /** @type {?} */ walker = value;
var /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
if (!found) {
if (!value || !FilterPipe.isFoundOnWalking(value, key)) {
return false;
}
var /** @type {?} */ val = _this.getValue(value[key]);
var /** @type {?} */ filterType = typeof filter[key];
var /** @type {?} */ isMatching = void 0;
if (filterType === 'boolean') {
isMatching = _this.filterByBoolean(filter[key])(val);
}
else if (filterType === 'string') {
isMatching = _this.filterByString(filter[key])(val);
}
else if (filterType === 'object') {
isMatching = _this.filterByObject(filter[key])(val);
}
else {
isMatching = _this.filterDefault(filter[key])(val);
}
if (!isMatching) {
if (!_this.isMatching(filter[key], FilterPipe.getValue(value[key]))) {
return false;

@@ -88,2 +92,18 @@ }

/**
* @param {?} filter
* @param {?} val
* @return {?}
*/
FilterPipe.prototype.isMatching = function (filter, val) {
switch (typeof filter) {
case 'boolean':
return this.filterByBoolean(filter)(val);
case 'string':
return this.filterByString(filter)(val);
case 'object':
return this.filterByObject(filter)(val);
}
return this.filterDefault(filter)(val);
};
/**
* Filter value by $or

@@ -95,30 +115,16 @@ * @param {?} filter

return function (value) {
var /** @type {?} */ hasMatch = false;
var /** @type {?} */ length = filter.length;
var /** @type {?} */ arrayComparison = function (i) {
return value.indexOf(filter[i]) !== -1;
};
var /** @type {?} */ otherComparison = function (i) {
return value === filter[i];
};
var /** @type {?} */ arrayComparison = function (i) { return value.indexOf(filter[i]) !== -1; };
var /** @type {?} */ otherComparison = function (i) { return value === filter[i]; };
var /** @type {?} */ comparison = Array.isArray(value) ? arrayComparison : otherComparison;
for (var /** @type {?} */ i = 0; i < length; i++) {
if (comparison(i)) {
hasMatch = true;
break;
return true;
}
}
return hasMatch;
return false;
};
};
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
FilterPipe.prototype.getValue = function (value) {
return typeof value === 'function' ? value() : value;
};
/**
* Defatul filterDefault function
* Default filterDefault function
* @param {?} filter

@@ -128,14 +134,5 @@ * @return {?}

FilterPipe.prototype.filterDefault = function (filter) {
return function (value) {
return filter === undefined || filter == value;
};
return function (value) { return filter === undefined || filter == value; };
};
/**
* @param {?} value
* @return {?}
*/
FilterPipe.prototype.isNumber = function (value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
};
/**
* @param {?} array

@@ -146,21 +143,18 @@ * @param {?} filter

FilterPipe.prototype.transform = function (array, filter) {
var /** @type {?} */ type = typeof filter;
if (!array) {
return array;
}
if (type === 'boolean') {
return array.filter(this.filterByBoolean(filter));
switch (typeof filter) {
case 'boolean':
return array.filter(this.filterByBoolean(filter));
case 'string':
if (FilterPipe.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
case 'object':
return array.filter(this.filterByObject(filter));
case 'function':
return array.filter(filter);
}
if (type === 'string') {
if (this.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
}
if (type === 'object') {
return array.filter(this.filterByObject(filter));
}
if (type === 'function') {
return array.filter(filter);
}
return array.filter(this.filterDefault(filter));

@@ -167,0 +161,0 @@ };

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],t):t(e["ngx-filter-pipe"]={},e.ng.core)}(this,function(e,t){"use strict";var r=function(){function e(){}return e.prototype.filterByString=function(e){return e&&(e=e.toLowerCase()),function(t){return!e||!!t&&-1!==(""+t).toLowerCase().indexOf(e)}},e.prototype.filterByBoolean=function(e){return function(t){return Boolean(t)===e}},e.prototype.filterByObject=function(e){var t=this;return function(r){for(var n in e)if("$or"!==n){var o=r,i=!1;do{if(o.hasOwnProperty(n)||Object.getOwnPropertyDescriptor(o,n)){i=!0;break}}while(o=Object.getPrototypeOf(o));if(!i)return!1;var f=t.getValue(r[n]),u=typeof e[n];if(!("boolean"===u?t.filterByBoolean(e[n])(f):"string"===u?t.filterByString(e[n])(f):"object"===u?t.filterByObject(e[n])(f):t.filterDefault(e[n])(f)))return!1}else if(!t.filterByOr(e.$or)(t.getValue(r)))return!1;return!0}},e.prototype.filterByOr=function(e){return function(t){for(var r=!1,n=e.length,o=Array.isArray(t)?function(r){return-1!==t.indexOf(e[r])}:function(r){return t===e[r]},i=0;i<n;i++)if(o(i)){r=!0;break}return r}},e.prototype.getValue=function(e){return"function"==typeof e?e():e},e.prototype.filterDefault=function(e){return function(t){return e===undefined||e==t}},e.prototype.isNumber=function(e){return!isNaN(parseInt(e,10))&&isFinite(e)},e.prototype.transform=function(e,t){var r=typeof t;return e?"boolean"===r?e.filter(this.filterByBoolean(t)):"string"===r?this.isNumber(t)?e.filter(this.filterDefault(t)):e.filter(this.filterByString(t)):"object"===r?e.filter(this.filterByObject(t)):"function"===r?e.filter(t):e.filter(this.filterDefault(t)):e},e}();r.decorators=[{type:t.Pipe,args:[{name:"filterBy",pure:!1}]},{type:t.Injectable}],r.ctorParameters=function(){return[]};var n=function(){return function(){}}();n.decorators=[{type:t.NgModule,args:[{declarations:[r],providers:[r],exports:[r]}]}],n.ctorParameters=function(){return[]},e.FilterPipeModule=n,e.FilterPipe=r,Object.defineProperty(e,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],e):e(t["ngx-filter-pipe"]={},t.ng.core)}(this,function(t,e){"use strict";var r=function(){function t(){}return t.isFoundOnWalking=function(t,e){var r=t,n=!1;do{if(r.hasOwnProperty(e)||Object.getOwnPropertyDescriptor(r,e)){n=!0;break}}while(r=Object.getPrototypeOf(r));return n},t.isNumber=function(t){return!isNaN(parseInt(t,10))&&isFinite(t)},t.getValue=function(t){return"function"==typeof t?t():t},t.prototype.filterByString=function(t){return t&&(t=t.toLowerCase()),function(e){return!t||!!e&&-1!==(""+e).toLowerCase().indexOf(t)}},t.prototype.filterByBoolean=function(t){return function(e){return Boolean(e)===t}},t.prototype.filterByObject=function(e){var r=this;return function(n){for(var i in e)if("$or"!==i){if(!n||!t.isFoundOnWalking(n,i))return!1;if(!r.isMatching(e[i],t.getValue(n[i])))return!1}else if(!r.filterByOr(e.$or)(t.getValue(n)))return!1;return!0}},t.prototype.isMatching=function(t,e){switch(typeof t){case"boolean":return this.filterByBoolean(t)(e);case"string":return this.filterByString(t)(e);case"object":return this.filterByObject(t)(e)}return this.filterDefault(t)(e)},t.prototype.filterByOr=function(t){return function(e){for(var r=t.length,n=Array.isArray(e)?function(r){return-1!==e.indexOf(t[r])}:function(r){return e===t[r]},i=0;i<r;i++)if(n(i))return!0;return!1}},t.prototype.filterDefault=function(t){return function(e){return t===undefined||t==e}},t.prototype.transform=function(e,r){if(!e)return e;switch(typeof r){case"boolean":return e.filter(this.filterByBoolean(r));case"string":return t.isNumber(r)?e.filter(this.filterDefault(r)):e.filter(this.filterByString(r));case"object":return e.filter(this.filterByObject(r));case"function":return e.filter(r)}return e.filter(this.filterDefault(r))},t}();r.decorators=[{type:e.Pipe,args:[{name:"filterBy",pure:!1}]},{type:e.Injectable}],r.ctorParameters=function(){return[]};var n=function(){return function(){}}();n.decorators=[{type:e.NgModule,args:[{declarations:[r],providers:[r],exports:[r]}]}],n.ctorParameters=function(){return[]},t.FilterPipeModule=n,t.FilterPipe=r,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-filter-pipe.umd.min.js.map

@@ -9,2 +9,33 @@ import { Pipe, Injectable, NgModule } from '@angular/core';

/**
* @param {?} value
* @param {?} key
* @return {?}
*/
static isFoundOnWalking(value, key) {
let /** @type {?} */ walker = value;
let /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
return found;
}
/**
* @param {?} value
* @return {?}
*/
static isNumber(value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
}
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
static getValue(value) {
return typeof value === 'function' ? value() : value;
}
/**
* @param {?} filter

@@ -17,5 +48,3 @@ * @return {?}

}
return value => {
return !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false);
};
return value => !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false);
}

@@ -27,5 +56,3 @@ /**

filterByBoolean(filter) {
return value => {
return Boolean(value) === filter;
};
return value => Boolean(value) === filter;
}

@@ -38,5 +65,5 @@ /**

return value => {
for (let /** @type {?} */ key in filter) {
for (const /** @type {?} */ key in filter) {
if (key === '$or') {
if (!this.filterByOr(filter.$or)(this.getValue(value))) {
if (!this.filterByOr(filter.$or)(FilterPipe.getValue(value))) {
return false;

@@ -46,29 +73,6 @@ }

}
let /** @type {?} */ walker = value;
let /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
if (!found) {
if (!value || !FilterPipe.isFoundOnWalking(value, key)) {
return false;
}
let /** @type {?} */ val = this.getValue(value[key]);
const /** @type {?} */ filterType = typeof filter[key];
let /** @type {?} */ isMatching;
if (filterType === 'boolean') {
isMatching = this.filterByBoolean(filter[key])(val);
}
else if (filterType === 'string') {
isMatching = this.filterByString(filter[key])(val);
}
else if (filterType === 'object') {
isMatching = this.filterByObject(filter[key])(val);
}
else {
isMatching = this.filterDefault(filter[key])(val);
}
if (!isMatching) {
if (!this.isMatching(filter[key], FilterPipe.getValue(value[key]))) {
return false;

@@ -81,2 +85,18 @@ }

/**
* @param {?} filter
* @param {?} val
* @return {?}
*/
isMatching(filter, val) {
switch (typeof filter) {
case 'boolean':
return this.filterByBoolean(filter)(val);
case 'string':
return this.filterByString(filter)(val);
case 'object':
return this.filterByObject(filter)(val);
}
return this.filterDefault(filter)(val);
}
/**
* Filter value by $or

@@ -88,30 +108,16 @@ * @param {?} filter

return (value) => {
let /** @type {?} */ hasMatch = false;
const /** @type {?} */ length = filter.length;
const /** @type {?} */ arrayComparison = (i) => {
return value.indexOf(filter[i]) !== -1;
};
const /** @type {?} */ otherComparison = (i) => {
return value === filter[i];
};
const /** @type {?} */ arrayComparison = (i) => value.indexOf(filter[i]) !== -1;
const /** @type {?} */ otherComparison = (i) => value === filter[i];
const /** @type {?} */ comparison = Array.isArray(value) ? arrayComparison : otherComparison;
for (let /** @type {?} */ i = 0; i < length; i++) {
if (comparison(i)) {
hasMatch = true;
break;
return true;
}
}
return hasMatch;
return false;
};
}
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
getValue(value) {
return typeof value === 'function' ? value() : value;
}
/**
* Defatul filterDefault function
* Default filterDefault function
* @param {?} filter

@@ -121,14 +127,5 @@ * @return {?}

filterDefault(filter) {
return (value) => {
return filter === undefined || filter == value;
};
return (value) => filter === undefined || filter == value;
}
/**
* @param {?} value
* @return {?}
*/
isNumber(value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
}
/**
* @param {?} array

@@ -139,21 +136,18 @@ * @param {?} filter

transform(array, filter) {
const /** @type {?} */ type = typeof filter;
if (!array) {
return array;
}
if (type === 'boolean') {
return array.filter(this.filterByBoolean(filter));
switch (typeof filter) {
case 'boolean':
return array.filter(this.filterByBoolean(filter));
case 'string':
if (FilterPipe.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
case 'object':
return array.filter(this.filterByObject(filter));
case 'function':
return array.filter(filter);
}
if (type === 'string') {
if (this.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
}
if (type === 'object') {
return array.filter(this.filterByObject(filter));
}
if (type === 'function') {
return array.filter(filter);
}
return array.filter(this.filterDefault(filter));

@@ -160,0 +154,0 @@ }

@@ -10,2 +10,33 @@ import { Pipe, Injectable, NgModule } from '@angular/core';

/**
* @param {?} value
* @param {?} key
* @return {?}
*/
FilterPipe.isFoundOnWalking = function (value, key) {
var /** @type {?} */ walker = value;
var /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
return found;
};
/**
* @param {?} value
* @return {?}
*/
FilterPipe.isNumber = function (value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
};
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
FilterPipe.getValue = function (value) {
return typeof value === 'function' ? value() : value;
};
/**
* @param {?} filter

@@ -18,5 +49,3 @@ * @return {?}

}
return function (value) {
return !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false);
};
return function (value) { return !filter || (value ? ('' + value).toLowerCase().indexOf(filter) !== -1 : false); };
};

@@ -28,5 +57,3 @@ /**

FilterPipe.prototype.filterByBoolean = function (filter) {
return function (value) {
return Boolean(value) === filter;
};
return function (value) { return Boolean(value) === filter; };
};

@@ -42,3 +69,3 @@ /**

if (key === '$or') {
if (!_this.filterByOr(filter.$or)(_this.getValue(value))) {
if (!_this.filterByOr(filter.$or)(FilterPipe.getValue(value))) {
return false;

@@ -48,29 +75,6 @@ }

}
var /** @type {?} */ walker = value;
var /** @type {?} */ found = false;
do {
if (walker.hasOwnProperty(key) || Object.getOwnPropertyDescriptor(walker, key)) {
found = true;
break;
}
} while (walker = Object.getPrototypeOf(walker));
if (!found) {
if (!value || !FilterPipe.isFoundOnWalking(value, key)) {
return false;
}
var /** @type {?} */ val = _this.getValue(value[key]);
var /** @type {?} */ filterType = typeof filter[key];
var /** @type {?} */ isMatching = void 0;
if (filterType === 'boolean') {
isMatching = _this.filterByBoolean(filter[key])(val);
}
else if (filterType === 'string') {
isMatching = _this.filterByString(filter[key])(val);
}
else if (filterType === 'object') {
isMatching = _this.filterByObject(filter[key])(val);
}
else {
isMatching = _this.filterDefault(filter[key])(val);
}
if (!isMatching) {
if (!_this.isMatching(filter[key], FilterPipe.getValue(value[key]))) {
return false;

@@ -83,2 +87,18 @@ }

/**
* @param {?} filter
* @param {?} val
* @return {?}
*/
FilterPipe.prototype.isMatching = function (filter, val) {
switch (typeof filter) {
case 'boolean':
return this.filterByBoolean(filter)(val);
case 'string':
return this.filterByString(filter)(val);
case 'object':
return this.filterByObject(filter)(val);
}
return this.filterDefault(filter)(val);
};
/**
* Filter value by $or

@@ -90,30 +110,16 @@ * @param {?} filter

return function (value) {
var /** @type {?} */ hasMatch = false;
var /** @type {?} */ length = filter.length;
var /** @type {?} */ arrayComparison = function (i) {
return value.indexOf(filter[i]) !== -1;
};
var /** @type {?} */ otherComparison = function (i) {
return value === filter[i];
};
var /** @type {?} */ arrayComparison = function (i) { return value.indexOf(filter[i]) !== -1; };
var /** @type {?} */ otherComparison = function (i) { return value === filter[i]; };
var /** @type {?} */ comparison = Array.isArray(value) ? arrayComparison : otherComparison;
for (var /** @type {?} */ i = 0; i < length; i++) {
if (comparison(i)) {
hasMatch = true;
break;
return true;
}
}
return hasMatch;
return false;
};
};
/**
* Checks function's value if type is function otherwise same value
* @param {?} value
* @return {?}
*/
FilterPipe.prototype.getValue = function (value) {
return typeof value === 'function' ? value() : value;
};
/**
* Defatul filterDefault function
* Default filterDefault function
* @param {?} filter

@@ -123,14 +129,5 @@ * @return {?}

FilterPipe.prototype.filterDefault = function (filter) {
return function (value) {
return filter === undefined || filter == value;
};
return function (value) { return filter === undefined || filter == value; };
};
/**
* @param {?} value
* @return {?}
*/
FilterPipe.prototype.isNumber = function (value) {
return !isNaN(parseInt(value, 10)) && isFinite(value);
};
/**
* @param {?} array

@@ -141,21 +138,18 @@ * @param {?} filter

FilterPipe.prototype.transform = function (array, filter) {
var /** @type {?} */ type = typeof filter;
if (!array) {
return array;
}
if (type === 'boolean') {
return array.filter(this.filterByBoolean(filter));
switch (typeof filter) {
case 'boolean':
return array.filter(this.filterByBoolean(filter));
case 'string':
if (FilterPipe.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
case 'object':
return array.filter(this.filterByObject(filter));
case 'function':
return array.filter(filter);
}
if (type === 'string') {
if (this.isNumber(filter)) {
return array.filter(this.filterDefault(filter));
}
return array.filter(this.filterByString(filter));
}
if (type === 'object') {
return array.filter(this.filterByObject(filter));
}
if (type === 'function') {
return array.filter(filter);
}
return array.filter(this.filterDefault(filter));

@@ -162,0 +156,0 @@ };

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"FilterPipeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FilterPipe"}],"providers":[{"__symbolic":"reference","name":"FilterPipe"}],"exports":[{"__symbolic":"reference","name":"FilterPipe"}]}]}],"members":{}},"FilterPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":5,"character":1},"arguments":[{"name":"filterBy","pure":false}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":10,"character":1}}],"members":{"filterByString":[{"__symbolic":"method"}],"filterByBoolean":[{"__symbolic":"method"}],"filterByObject":[{"__symbolic":"method"}],"filterByOr":[{"__symbolic":"method"}],"getValue":[{"__symbolic":"method"}],"filterDefault":[{"__symbolic":"method"}],"isNumber":[{"__symbolic":"method"}],"transform":[{"__symbolic":"method"}]}}},"origins":{"FilterPipeModule":"./src/app/shared/ngx-filter-pipe/ngx-filter.module","FilterPipe":"./src/app/shared/ngx-filter-pipe/ngx-filter.pipe"},"importAs":"ngx-filter-pipe"}
{"__symbolic":"module","version":4,"metadata":{"FilterPipeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FilterPipe"}],"providers":[{"__symbolic":"reference","name":"FilterPipe"}],"exports":[{"__symbolic":"reference","name":"FilterPipe"}]}]}],"members":{}},"FilterPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":5,"character":1},"arguments":[{"name":"filterBy","pure":false}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":10,"character":1}}],"members":{"filterByString":[{"__symbolic":"method"}],"filterByBoolean":[{"__symbolic":"method"}],"filterByObject":[{"__symbolic":"method"}],"isMatching":[{"__symbolic":"method"}],"filterByOr":[{"__symbolic":"method"}],"filterDefault":[{"__symbolic":"method"}],"transform":[{"__symbolic":"method"}]},"statics":{"isNumber":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"reference","name":"parseInt"},"arguments":[{"__symbolic":"reference","name":"value"},10]}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFinite"},"arguments":[{"__symbolic":"reference","name":"value"}]}}},"getValue":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":34,"character":11,"module":"./src/app/shared/ngx-filter-pipe/ngx-filter.pipe"},"right":"function"},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"value"}},"elseExpression":{"__symbolic":"reference","name":"value"}}}}}},"origins":{"FilterPipeModule":"./src/app/shared/ngx-filter-pipe/ngx-filter.module","FilterPipe":"./src/app/shared/ngx-filter-pipe/ngx-filter.pipe"},"importAs":"ngx-filter-pipe"}
{
"name": "ngx-filter-pipe",
"version": "2.1.0",
"version": "2.1.1",
"description": "Angular 5+ pipeline for filtering arrays",

@@ -5,0 +5,0 @@ "author": "Vadym Yatsyuk <vadym.yatsyuk@gmail.com>",

@@ -37,2 +37,21 @@ <h1 align="center">Angular5+ Filter Pipe</h1>

or see demo code
[https://stackblitz.com/edit/ngx-filter-pipe](https://stackblitz.com/edit/ngx-filter-pipe)
### Usage
##### In HTML template
```
{{ collection | filterBy: searchTerm }}
```
### Arguments
| Param | Type | Default | Details |
| --- | --- | --- | --- |
| collection | `array` | - | The collection to filter |
| searchTerm | `string` or `number` or `object` or `array` or `function` | - | Predicate used to filter items from `collection` |
## Install

@@ -45,6 +64,8 @@

## Usage
## Setup
In case you're using ```SystemJS``` - see configuration [here](https://github.com/VadimDez/ngx-filter-pipe/blob/master/SYSTEMJS.md).
## Usage
Import `FilterPipeModule` to your module

@@ -113,3 +134,3 @@

Result:
Result will be:
```html

@@ -116,0 +137,0 @@ <div>English</div>

@@ -6,5 +6,12 @@ /**

export declare class FilterPipe implements PipeTransform {
static isFoundOnWalking(value: any, key: any): boolean;
static isNumber(value: any): boolean;
/**
* Checks function's value if type is function otherwise same value
*/
static getValue(value: any): any;
private filterByString(filter);
private filterByBoolean(filter);
private filterByObject(filter);
private isMatching(filter, val);
/**

@@ -15,11 +22,6 @@ * Filter value by $or

/**
* Checks function's value if type is function otherwise same value
* Default filterDefault function
*/
private getValue(value);
/**
* Defatul filterDefault function
*/
private filterDefault(filter);
private isNumber(value);
transform(array: any[], filter: any): any;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc