a8m / a8m/angular-filter

Add ===null to all filter params

Aberta
#114 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
2.9k
Forks
319
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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?

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.