nomonic
    Preparing search index...

    Function detectBip39Sequences

    • Detect sequences of consecutive BIP39 mnemonic words in text content. Returns violations where threshold or more consecutive BIP39 words appear.

      Detection operates in two modes:

      1. Single-line: finds sequences of BIP39 words within a line (handles mixed content).
      2. Cross-line: accumulates words across consecutive "BIP39-pure" lines (where every non-skip token is a BIP39 word). Blank or whitespace-only lines are transparent and do not break the sequence. Catches one-per-line, numbered lists, formatted blocks, and grids.

      Tokens are stripped of surrounding punctuation (quotes, commas, brackets, etc.) before matching. Interior punctuation (hyphens, apostrophes) still disqualifies a token. Purely non-alphabetic tokens (like "1.", "2)", "//") are skipped without breaking a sequence.

      Parameters

      • content: string

        The text content to scan for BIP39 sequences.

      • threshold: number = DEFAULT_THRESHOLD

        Minimum number of consecutive BIP39 words to trigger a violation (default: DEFAULT_THRESHOLD).

      Returns Bip39Violation[]

      An array of Bip39Violation objects, one per detected sequence.

      const violations = detectBip39Sequences(
      'abandon ability able about above absent absorb abstract absurd abuse access accident',
      )
      // violations[0].matchedWords.length === 12