diff --git a/.all-contributorsrc b/.all-contributorsrc
index 354d45c..ef0770e 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -95,6 +95,15 @@
"test",
"ideas"
]
+ },
+ {
+ "login": "pushpinder107",
+ "name": "pushpinder107",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/9403361?v=4",
+ "profile": "https://github.com/pushpinder107",
+ "contributions": [
+ "code"
+ ]
}
],
"repoType": "github"
diff --git a/README.md b/README.md
index 69869e3..5af62d4 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][license]
-[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
+[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Donate][donate-badge]][donate]
[![Code of Conduct][coc-badge]][coc]
@@ -273,7 +273,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [
Kent C. Dodds](https://kentcdodds.com)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds "Code") [π](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds "Documentation") [π](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds "Tests") [π](#review-kentcdodds "Reviewed Pull Requests") | [
Conor Hastings](http://conorhastings.com)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings "Code") [π](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings "Documentation") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings "Tests") [π](#review-conorhastings "Reviewed Pull Requests") | [
Rogelio Guzman](https://github.com/rogeliog)
[π](https://github.com/kentcdodds/match-sorter/commits?author=rogeliog "Documentation") | [
ClaudΓ©ric Demers](http://ced.io)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=clauderic "Code") [π](https://github.com/kentcdodds/match-sorter/commits?author=clauderic "Documentation") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=clauderic "Tests") | [
Kevin Davis](kevindav.us)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=osfan501 "Code") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=osfan501 "Tests") | [
Denver Chen](https://github.com/nfdjps)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps "Code") [π](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps "Documentation") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps "Tests") | [
Christian Ruigrok](http://ruigrok.info)
[π](https://github.com/kentcdodds/match-sorter/issues?q=author%3AChrisRu "Bug reports") [π»](https://github.com/kentcdodds/match-sorter/commits?author=ChrisRu "Code") [π](https://github.com/kentcdodds/match-sorter/commits?author=ChrisRu "Documentation") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
-| [
Hozefa](https://github.com/hozefaj)
[π](https://github.com/kentcdodds/match-sorter/issues?q=author%3Ahozefaj "Bug reports") [π»](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Code") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Tests") [π€](#ideas-hozefaj "Ideas, Planning, & Feedback") |
+| [
Hozefa](https://github.com/hozefaj)
[π](https://github.com/kentcdodds/match-sorter/issues?q=author%3Ahozefaj "Bug reports") [π»](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Code") [β οΈ](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Tests") [π€](#ideas-hozefaj "Ideas, Planning, & Feedback") | [
pushpinder107](https://github.com/pushpinder107)
[π»](https://github.com/kentcdodds/match-sorter/commits?author=pushpinder107 "Code") |
diff --git a/src/__tests__/index.js b/src/__tests__/index.js
index 7172dbe..ba4ee0f 100644
--- a/src/__tests__/index.js
+++ b/src/__tests__/index.js
@@ -111,6 +111,19 @@ const tests = {
{first: 'not', second: 'not', third: 'not', fourth: 'match'},
],
},
+ 'can handle the number 0 as a property value': {
+ input: [
+ [
+ {name: 'A', age: 0},
+ {name: 'B', age: 1},
+ {name: 'C', age: 2},
+ {name: 'D', age: 3},
+ ],
+ '0',
+ {keys: ['age']},
+ ],
+ output: [{name: 'A', age: 0}],
+ },
'can handle objected with nested keys': {
input: [
[
diff --git a/src/index.js b/src/index.js
index cc5b3e2..58f66e2 100644
--- a/src/index.js
+++ b/src/index.js
@@ -387,7 +387,8 @@ function getItemValues(item, key) {
value = item[key]
}
// concat because `value` can be a string or an array
- return value ? [].concat(value) : null
+ // eslint-disable-next-line
+ return value != null ? [].concat(value) : null
}
/**