@@ -13,7 +13,7 @@ import { Context } from '@inquirer/type';
1313type PasswordConfig = PromptConfig < {
1414 mask ?: boolean | string ;
1515 validate ?: ( value : string ) => boolean | string | Promise < string | boolean > ;
16- allowShowPassowrd ?: boolean ;
16+ allowShowPassword ?: boolean ;
1717} > ;
1818
1919const 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