a8m / a8m/angular-filter

Add ===null to all filter params

オープン
#114 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
2.9k
フォーク
319
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently the (in my instance) fuzzyBy filter has this code in it

```
if(!isArray(collection) || isUndefined(property)
|| isUndefined(search)) {
return collection;
}
```

Search is the key word. Now say i have this value modeled to an input, when the input is blank it is set to null, but angular.isUndefined() does a typeof check on the value, not a ==undefined, or ==null.

Because of this whenever the input is blank nothing is returned by the filter. This is not the desired result is it?

This is simply fixed by changing the above to

```
if(!isArray(collection) || isUndefined(property)
|| search == null) {
return collection;
}
```

Because ==null will evaluate to true if search is null or undefined this should fit the bill here.

Are there any downsides to doing this everywhere?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。