Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!value) {
return {amountIsRequired: true}
}
try {
parseAdaDecimal(value)
return {}
} catch (e) {
if (e instanceof InvalidAdaAmount) {
return {invalidAmount: e.errorCode}
}
throw e
}
}
wordlists.EN.forEach((word) => {
assert.assert(
word === word.toLowerCase(),
'we expect wordlist to contain only lowercase words',
)
})
const MNEMONIC_LENGTH = 15
export const cleanMnemonic = (mnemonic: string) => {
// get rid of common punctuation
mnemonic = mnemonic.replace(/[.,?]/g, ' ')
// normalize whitespace
mnemonic = mnemonic.replace(/\s+/g, ' ')
// dictionary does not contain uppercase characters
mnemonic = mnemonic.toLowerCase()
// remove leading/trailing whitespace
private handleInputChange = (text: string): void => {
let matches = [] as string[]
if (text.length >= 2) {
matches = wordlists.EN.filter((word: string): boolean =>
word.startsWith(text.trim()),
)
}
this.setState({
inputValue: text,
suggestions: matches.slice(0, 10),
})
}
const isUnknown = (word) => !wordlists.EN.includes(word)