Misc Primitive Fixes

This commit is contained in:
Jim Hamill
2025-01-15 03:05:53 +00:00
parent 9348648584
commit a51da6770f
15 changed files with 119 additions and 109 deletions
+4 -7
View File
@@ -14,7 +14,7 @@ export type MnemonicRaw = {
* Supports 12, 15, 18, 21, and 24 word phrases with optional passphrase.
*/
export class Mnemonic {
public static VALID_WORD_COUNTS = new Set([12, 15, 18, 21, 24]);
protected static VALID_WORD_COUNTS = new Set([12, 15, 18, 21, 24]);
/**
* Instantiate Mnemonic from a phrase string.
@@ -40,12 +40,9 @@ export class Mnemonic {
phraseOrWords: string | Array<string>,
wordList: Array<string> = bip39WordListEnglish,
) {
// If this is a list of words...
if (Array.isArray(phraseOrWords)) {
return this.fromWords(phraseOrWords, wordList);
}
return this.fromPhrase(phraseOrWords, wordList);
return Array.isArray(phraseOrWords)
? this.fromWords(phraseOrWords, wordList)
: this.fromPhrase(phraseOrWords, wordList);
}
/**