Skip to content

fix: treat SoundEx initial characters literally - #782

Open
ryanchou1994 wants to merge 1 commit into
NaturalNode:masterfrom
ryanchou1994:fix/soundex-literal-prefix
Open

ryanchou1994 wants to merge 1 commit into
NaturalNode:masterfrom
ryanchou1994:fix/soundex-literal-prefix

Conversation

@ryanchou1994

Copy link
Copy Markdown

Fixes #541

Proposed Changes

  • Compare the initial SoundEx code directly when removing duplicate initial consonant sounds. Building a regular expression from the first character can throw for inputs such as [foo], (foo), and *foo, or remove the wrong code for .foo.
  • Add Jasmine regressions for those inputs and controls for empty input, Pfister, and the example with literal backticks.

Validation

  • The new regressions fail on the original implementation: 20 SoundEx specs, 4 failures. With the fix, all 20 pass on macOS and Linux.
  • All 863 unit specs pass on both platforms, along with the TypeScript test build, ESM build, and TypeScript lint. StandardJS and a duplication check of the two changed files also pass.
  • The existing ESM smoke test and 16 assertions through the actual CommonJS and built ESM exports pass on both platforms.
  • Tests ran with isolated configuration; Linux verification used a container with networking disabled. The IO suite and combined coverage command were not run because they require database services.

Checklist before merging

  • Added Jasmine tests
  • Updates TypeScipt index.d.ts files — not applicable; public signatures are unchanged.

Copilot AI lite review requested due to automatic review settings September 9, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

natural@2.1.5 - phonetics/soundex - Unterminated character class

2 participants