Skip to content

Commit dc7f360

Browse files
committed
Simplify constructor for loop by including < 32 in condition
1 parent 2731bf8 commit dc7f360

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/ReactCodeInput.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ class ReactCodeInput extends Component {
5151
},
5252
};
5353

54-
for (let i = 0; i < Number(this.state.fields); i += 1) {
55-
if (i < 32) {
56-
const value = this.state.value[i] || '';
57-
this.state.input.push(value);
58-
}
54+
for (let i = 0; i < Number(this.state.fields) && i < 32; i += 1) {
55+
const value = this.state.value[i] || '';
56+
this.state.input.push(value);
5957
}
6058

6159
this.textInput = [];

0 commit comments

Comments
 (0)