Skip to content

Commit 7c6507b

Browse files
Chore (password): fix typo
1 parent 1739492 commit 7c6507b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/password/password.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('password prompt', () => {
102102
const { answer, events, getScreen } = await render(password, {
103103
message: 'Enter your password',
104104
mask: true,
105-
allowShowPassowrd: false,
105+
allowShowPassword: false,
106106
});
107107

108108
expect(getScreen()).toMatchInlineSnapshot('"? Enter your password"');
@@ -128,7 +128,7 @@ describe('password prompt', () => {
128128
const { answer, events, getScreen } = await render(password, {
129129
message: 'Enter your password',
130130
mask: true,
131-
allowShowPassowrd: true,
131+
allowShowPassword: true,
132132
});
133133

134134
expect(getScreen()).toMatchInlineSnapshot(

packages/password/src/index.mts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Context } from '@inquirer/type';
1313
type PasswordConfig = PromptConfig<{
1414
mask?: boolean | string;
1515
validate?: (value: string) => boolean | string | Promise<string | boolean>;
16-
allowShowPassowrd?: boolean;
16+
allowShowPassword?: boolean;
1717
}>;
1818

1919
const transformer = (
@@ -41,11 +41,11 @@ export default (config: PasswordConfig, context?: Context | undefined) => {
4141
}
4242

4343
return createPrompt<string, PasswordConfig>((_config, done) => {
44-
const { validate = () => true, allowShowPassowrd } = _config;
44+
const { validate = () => true, allowShowPassword } = _config;
4545
const [status, setStatus] = useState<string>('pending');
4646
const [errorMsg, setError] = useState<string | undefined>(undefined);
4747
const [value, setValue] = useState<string>('');
48-
const [togglePassowrd, setTogglePassword] = useState<boolean>(false);
48+
const [togglePassword, setTogglePassword] = useState<boolean>(false);
4949

5050
const isLoading = status === 'loading';
5151
const prefix = usePrefix(isLoading);
@@ -71,12 +71,12 @@ export default (config: PasswordConfig, context?: Context | undefined) => {
7171
setError(isValid || 'You must provide a valid value');
7272
setStatus('pending');
7373
}
74-
} else if (allowShowPassowrd && key.ctrl === true && key.name === '`') {
74+
} else if (allowShowPassword && key.ctrl === true && key.name === '`') {
7575
// CTRL + Space
7676
// I only tried on Linux, but the combination on Linux was reported like that
7777
// key.crtl = true
7878
// key.name = '`'
79-
setTogglePassword(!togglePassowrd);
79+
setTogglePassword(!togglePassword);
8080
setValue(rl.line);
8181
setError(undefined);
8282
} else {
@@ -87,7 +87,7 @@ export default (config: PasswordConfig, context?: Context | undefined) => {
8787

8888
const message = chalk.bold(_config.message);
8989
let formattedValue = transformer(value, _config.mask, { isFinal: status === 'done' });
90-
if (togglePassowrd && status !== 'done') {
90+
if (togglePassword && status !== 'done') {
9191
formattedValue = value;
9292
}
9393

@@ -102,7 +102,7 @@ export default (config: PasswordConfig, context?: Context | undefined) => {
102102

103103
return [
104104
`${prefix} ${message}${
105-
allowShowPassowrd ? chalk.dim(' (press CTRL+Space to show the password)') : ''
105+
allowShowPassword ? chalk.dim(' (press CTRL+Space to show the password)') : ''
106106
} ${formattedValue}`,
107107
error,
108108
];

0 commit comments

Comments
 (0)