Skip to content

Commit e954204

Browse files
aromalanilapollonian
authored andcommitted
Reduced if-else conditions into smaller block
1 parent 9cdba96 commit e954204

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/lib/index.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,9 @@ class OtpInput extends Component<Props, State> {
149149
return;
150150
}
151151

152-
if (placeholder.length === 1) {
153-
return placeholder.repeat(numInputs);
154-
} else if (placeholder.length === numInputs) {
155-
return placeholder;
156-
} else {
157-
console.error('Invalid placeholder value');
158-
}
152+
if (placeholder.length === 1) return placeholder.repeat(numInputs);
153+
else if (placeholder.length === numInputs) return placeholder;
154+
else console.error('Invalid placeholder value');
159155
}
160156
};
161157

0 commit comments

Comments
 (0)