{"id":14973338,"url":"https://github.com/vadimdez/ngx-filter-pipe","last_synced_at":"2025-04-09T05:10:22.599Z","repository":{"id":9827433,"uuid":"61863180","full_name":"VadimDez/ngx-filter-pipe","owner":"VadimDez","description":"𝗩 Angular 5+ pipeline for array filtering.","archived":false,"fork":false,"pushed_at":"2024-09-08T19:31:34.000Z","size":11261,"stargazers_count":144,"open_issues_count":36,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T04:03:32.208Z","etag":null,"topics":["angular-2","array-filter","filter","filter-array","pipe"],"latest_commit_sha":null,"homepage":"https://vadimdez.github.io/ngx-filter-pipe","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VadimDez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/vadimdez"]}},"created_at":"2016-06-24T06:51:16.000Z","updated_at":"2025-02-04T10:43:47.000Z","dependencies_parsed_at":"2024-01-06T00:13:21.485Z","dependency_job_id":"dedece3a-8431-47d2-b003-28e51ebb76dd","html_url":"https://github.com/VadimDez/ngx-filter-pipe","commit_stats":{"total_commits":298,"total_committers":9,"mean_commits":"33.111111111111114","dds":0.261744966442953,"last_synced_commit":"395ba75ab645e0a619b89220ff46b0aa1c3be4f9"},"previous_names":["vadimdez/ng2-filter-pipe"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-filter-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-filter-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-filter-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VadimDez%2Fngx-filter-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VadimDez","download_url":"https://codeload.github.com/VadimDez/ngx-filter-pipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular-2","array-filter","filter","filter-array","pipe"],"created_at":"2024-09-24T13:48:34.631Z","updated_at":"2025-04-09T05:10:22.582Z","avatar_url":"https://github.com/VadimDez.png","language":"TypeScript","funding_links":["https://paypal.me/vadimdez","https://www.paypal.me/vadimdez"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eAngular5+ Filter Pipe\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ngx-filter-pipe\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ngx-filter-pipe.svg?style=flat\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://www.npmjs.com/package/ng2-filter-pipe\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ng2-filter-pipe.svg?style=flat\" alt=\"downloads\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://badge.fury.io/js/ngx-filter-pipe\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/ngx-filter-pipe.svg\" alt=\"npm version\" height=\"18\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://david-dm.org/vadimdez/ngx-filter-pipe\" title=\"dependencies status\"\u003e\n    \u003cimg src=\"https://david-dm.org/vadimdez/ngx-filter-pipe.svg\" height=\"18\"\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://greenkeeper.io/\" title=\"Greenkeeper badge\"\u003e\n    \u003cimg src=\"https://badges.greenkeeper.io/VadimDez/ngx-filter-pipe.svg\" alt=\"Greenkeeper badge\" /\u003e\n  \u003c/a\u003e\n  \n  \u003ca href=\"https://www.paypal.me/vadimdez\" title=\"Donate to this project using Paypal\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Filter arrays\n \nAngular 5+ pipeline for filtering arrays.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/3748453/23809236/3276cf26-05cd-11e7-94f7-b4078104adbd.gif\" width=\"300\"\u003e\n\u003c/p\u003e\n\n### Demo Page\n\n[https://vadimdez.github.io/ngx-filter-pipe/](https://vadimdez.github.io/ngx-filter-pipe/)\n\nor see demo code\n\n[https://stackblitz.com/edit/ngx-filter-pipe](https://stackblitz.com/edit/ngx-filter-pipe)\n\n### Usage\n\n##### In HTML template\n\n```\n{{ collection | filterBy: searchTerm }}\n```\n\n### Arguments\n\n| Param | Type | Details |\n| --- | --- | --- |\n| collection | `array` | The collection to filter |\n| searchTerm  | `string` or `number` or `object` or `array` or `function` | Predicate used to filter items from `collection` |\n\n## Install\n\n```\nnpm install ngx-filter-pipe --save\n```\n*For Angular lower than 5 use version `1.0.2`*\n\n## Setup\n\nIn case you're using ```SystemJS``` - see configuration [here](https://github.com/VadimDez/ngx-filter-pipe/blob/master/SYSTEMJS.md).\n\n## Usage\n\nImport `FilterPipeModule` to your module\n\n```ts\nimport { NgModule } from '@angular/core';\nimport { BrowserModule  } from '@angular/platform-browser';\nimport { AppComponent } from './app';\n \nimport { FilterPipeModule } from 'ngx-filter-pipe';\nimport { FormsModule } from '@angular/forms';\n\n@NgModule({\n  imports: [BrowserModule, FormsModule, FilterPipeModule],\n  declarations: [AppComponent],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {}\n\n```\n\nAnd use pipe in your component\n```ts\nimport { Component } from '@angular/core';\n \n@Component({\n  selector: 'example-app',\n  template: `\n    \u003cdiv\u003e\n        \u003cinput type=\"text\" [(ngModel)]=\"userFilter.name\" placeholder=\"name\"\u003e\n        \u003cul\u003e\n          \u003cli *ngFor=\"let user of users | filterBy: userFilter\"\u003e{{ user.name }}\u003c/li\u003e\n          \n          \u003c!-- in case you want to show empty message --\u003e\n          \u003cli *ngIf=\"(users | filterBy: userFilter).length === 0\"\u003eNo matching elements\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/div\u003e  \n  `\n})\n \nexport class AppComponent {\n  users: any[] = [{ name: 'John' }, { name: 'Jane' }, { name: 'Mario' }];\n  userFilter: any = { name: '' };\n}\n```\n\n### $or matching\nUse `$or` to filter by more then one values.\n\n`$or` expects an `Array`.\n\nIn your component:\n```ts\n// your array\nconst languages = ['English', 'German', 'Russian', 'Italian', 'Ukrainian'];\n// your $or filter\nconst filter = { $or: ['German', 'English'] };\n```\n\nIn your template:\n```html\n\u003cdiv *ngFor=\"let language of languages | filterBy: filter\"\u003e\n  {{ language }}\n\u003c/div\u003e\n```\n\nResult will be:\n```html\n\u003cdiv\u003eEnglish\u003c/div\u003e\n\u003cdiv\u003eGerman\u003c/div\u003e\n```\n\n#### $or example with nessted values\nIn your component:\n```ts\n// your array\nconst languages = [\n  { language: 'English' },\n  { language: 'German' },\n  { language: 'Italian' }\n];\n\n// your $or filter\nconst filter = {\n  language: {\n    $or: ['Italian', 'English']\n  }\n};\n```\n\nIn your template:\n```html\n\u003cdiv *ngFor=\"let object of languages | filterBy: filter\"\u003e\n  {{ object.language }}\n\u003c/div\u003e\n```\n\nResult:\n```html\n\u003cdiv\u003eEnglish\u003c/div\u003e\n\u003cdiv\u003eItalian\u003c/div\u003e\n```\n\n#### $or example with multiple predicates\n\n```\nconst objects = [\n  { name: 'John' },\n  { firstName: 'John' }\n]\n\nconst filter = { $or: [{ name: 'John' }, { firstName: 'John' }] }\n```\nIn your template:\n```html\n\u003cdiv *ngFor=\"let object of objects | filterBy: filter\"\u003e\n  {{ object | json }}\n\u003c/div\u003e\n```\n\nResult:\n```html\n\u003cdiv\u003e{ name: 'John' }\u003c/div\u003e\n\u003cdiv\u003e{ firstName: 'John' }\u003c/div\u003e\n```\n\n### Use FilterPipe in a component\n\nInject `FilterPipe` into your component and use it:\n\n```ts\nclass AppComponent {\n  objects = [\n    { name: 'John' },\n    { name: 'Nick' },\n    { name: 'Jane' }\n  ];\n  \n  constructor(private filter: FilterPipe) {\n    let result = this.filter.transform(this.objects, { name: 'J' });\n    console.log(result); // [{ name: 'John' }, { name: 'Jane' }]\n  }\n}\n```\n\n## Test\n\nRun tests\n\n```\nnpm test\n```\n\n## Contribute\n\n## License\n\n[MIT](https://tldrlegal.com/license/mit-license) © [Vadym Yatsyuk](https://github.com/vadimdez)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimdez%2Fngx-filter-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvadimdez%2Fngx-filter-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvadimdez%2Fngx-filter-pipe/lists"}