From 0d619117188e2e736992536ad541d38d2803fe82 Mon Sep 17 00:00:00 2001 From: Stuart Casarotto Date: Sun, 8 Apr 2018 14:37:03 -0500 Subject: [PATCH] Handle Searching for Numbers A quick fix for issue 40 (https://github.com/selvagsz/react-power-select/issues/40). Feel free to adjust if this is suboptimal. --- src/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index e2454b1..5b80169 100644 --- a/src/utils.js +++ b/src/utils.js @@ -7,7 +7,10 @@ export const matcher = ({ option, searchTerm = '', searchIndices }) => { } if (searchIndices) { return makeArray(searchIndices).some(index => { - return (option[index] || '').toLowerCase().indexOf(searchTerm) !== -1; + if (typeof (option[index] || '') === 'string') { + return (option[index] || '').toLowerCase().indexOf(searchTerm) !== -1; + } + return (String(option[index]) || '').toLowerCase().indexOf(searchTerm) !== -1; }); } return true;