Skip to content

Commit

Permalink
closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimDez committed Dec 1, 2016
1 parent 5c481b2 commit 09217c2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.1
* [[#7](https://github.com/VadimDez/ng2-filter-pipe/issues/7)] - Fails if trying to filter null


## 0.1.0
* [[#9](https://github.com/VadimDez/ng2-filter-pipe/issues/9)] - Update dependencies
* [[#10](https://github.com/VadimDez/ng2-filter-pipe/issues/10)] - Added filter by boolean
Expand Down
3 changes: 2 additions & 1 deletion examples/ng-cli/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { Ng2FilterPipeModule } from 'ng2-filter-pipe';

@NgModule({
declarations: [
AppComponent
AppComponent,
// Ng2FilterPipe
],
imports: [
BrowserModule,
Expand Down
4 changes: 4 additions & 0 deletions examples/ng-cli/src/app/shared/ng2-filter.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export class Ng2FilterPipe {
transform(array: any[], filter: any): any {
const type = typeof filter;

if (!array) {
return array;
}

if (type === 'boolean') {
return array.filter(this.filterByBoolean(filter));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-filter-pipe",
"version": "0.1.0",
"version": "0.1.1",
"author": "Vadym Yatsyuk <[email protected]>",
"license": "MIT",
"angular-cli": {},
Expand Down
4 changes: 4 additions & 0 deletions src/ng2-filter.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export class Ng2FilterPipe {
transform(array: any[], filter: any): any {
const type = typeof filter;

if (!array) {
return array;
}

if (type === 'boolean') {
return array.filter(this.filterByBoolean(filter));
}
Expand Down

0 comments on commit 09217c2

Please sign in to comment.