Skip to content

Commit 6693d9a

Browse files
aromalanilapollonian
authored andcommitted
Removed unwanted if condition
Removed placeholder !== undefined condition
1 parent e954204 commit 6693d9a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/lib/index.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,12 @@ class OtpInput extends Component<Props, State> {
143143

144144
getPlaceholderValue = () => {
145145
const { placeholder, numInputs } = this.props;
146-
if (placeholder !== undefined) {
147-
if (typeof placeholder !== 'string') {
148-
console.error('Placeholder should be a string');
149-
return;
150-
}
151-
146+
if (typeof placeholder === 'string') {
152147
if (placeholder.length === 1) return placeholder.repeat(numInputs);
153148
else if (placeholder.length === numInputs) return placeholder;
154149
else console.error('Invalid placeholder value');
155150
}
151+
return;
156152
};
157153

158154
// Helper to return OTP from input

0 commit comments

Comments
 (0)