(passedOptions: Record<string, any>)
| 79 | ambiguous: boolean; |
| 80 | |
| 81 | constructor(passedOptions: Record<string, any>) { |
| 82 | this.uppercase = CliUtils.convertBooleanOption(passedOptions?.uppercase); |
| 83 | this.lowercase = CliUtils.convertBooleanOption(passedOptions?.lowercase); |
| 84 | this.number = CliUtils.convertBooleanOption(passedOptions?.number); |
| 85 | this.special = CliUtils.convertBooleanOption(passedOptions?.special); |
| 86 | this.capitalize = CliUtils.convertBooleanOption(passedOptions?.capitalize); |
| 87 | this.includeNumber = CliUtils.convertBooleanOption(passedOptions?.includeNumber); |
| 88 | this.ambiguous = CliUtils.convertBooleanOption(passedOptions?.ambiguous); |
| 89 | this.length = CliUtils.convertNumberOption( |
| 90 | passedOptions?.length, |
| 91 | DefaultPasswordGenerationOptions.length, |
| 92 | ); |
| 93 | this.type = CliUtils.convertBooleanOption(passedOptions?.passphrase) |
| 94 | ? "passphrase" |
| 95 | : "password"; |
| 96 | this.separator = CliUtils.convertStringOption( |
| 97 | passedOptions?.separator, |
| 98 | DefaultPassphraseGenerationOptions.wordSeparator, |
| 99 | ); |
| 100 | this.words = CliUtils.convertNumberOption( |
| 101 | passedOptions?.words, |
| 102 | DefaultPassphraseGenerationOptions.numWords, |
| 103 | ); |
| 104 | this.minNumber = CliUtils.convertNumberOption( |
| 105 | passedOptions?.minNumber, |
| 106 | DefaultPasswordGenerationOptions.minNumber, |
| 107 | ); |
| 108 | this.minSpecial = CliUtils.convertNumberOption( |
| 109 | passedOptions?.minSpecial, |
| 110 | DefaultPasswordGenerationOptions.minSpecial, |
| 111 | ); |
| 112 | |
| 113 | if (!this.uppercase && !this.lowercase && !this.special && !this.number) { |
| 114 | this.lowercase = true; |
| 115 | this.uppercase = true; |
| 116 | this.number = true; |
| 117 | } |
| 118 | if (this.length < 5) { |
| 119 | this.length = 5; |
| 120 | } |
| 121 | if (this.words < 3) { |
| 122 | this.words = 3; |
| 123 | } |
| 124 | if (this.separator === "space") { |
| 125 | this.separator = " "; |
| 126 | } else if (this.separator === "empty") { |
| 127 | this.separator = ""; |
| 128 | } else if (this.separator != null && this.separator.length > 1) { |
| 129 | this.separator = this.separator[0]; |
| 130 | } |
| 131 | } |
| 132 | } |
nothing calls this directly
no test coverage detected