Skip to content

Commit d971717

Browse files
committed
Enable early return from filterKeyCodes check
Array.prototype.map() won’t early return if you return true, but Array.prototype.some() will
1 parent 4ba749a commit d971717

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ReactCodeInput.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,12 @@ class ReactCodeInput extends Component {
161161
value;
162162

163163
if (this.state.filterKeyCodes.length > 0) {
164-
this.state.filterKeyCodes.map((item) => {
164+
this.state.filterKeyCodes.some((item) => {
165165
if (item === e.keyCode) {
166166
e.preventDefault();
167167
return true;
168168
}
169+
return false;
169170
});
170171
}
171172

0 commit comments

Comments
 (0)