All files / app/utils parse-seed-phrase.ts

90.9% Statements 10/11
66.66% Branches 2/3
100% Functions 6/6
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 121x 7x 7x 7x 264x 264x 240x 240x 168x 7x    
export function parseSeedPhraseInput(input: string) {
  const parsedInput = input.trim().match(/\S+/g);
  Iif (!parsedInput) return null;
  const seed = parsedInput
    .map(item => (item.match(/[^0-9]+/g) ? item : null))
    .filter(word => typeof word === 'string')
    .filter(word => !!word)
    .filter(word => /^[A-Za-z ]+$/.test(word as string))
    .map(word => (word as string).toLowerCase());
  return seed.join(' ');
}