sindresorhus/eslint-plugin-unicorn
Rule proposal: `prefer-map-has`
Fechada
#1.329 aberto em 3 de jun. de 2021
help wantednew ruletypes
Métricas do repositório
- Stars
- (5.022 estrelas)
- Métricas de merge de PR
- (Mesclagem média 4h 30m) (26 fundiu PRs em 30d)
Description
When checking existence, should prefer Map#has() over Map#get().
Fail
if (map.get(foo));
Pass
if (map.has(foo));
I think better ship this with prefer-map together, so user can notice this problem when we fix object.foo to map.get(foo) in prefer-map.