1.0.8 • Published 5 years ago
@jollie/soundex v1.0.8
soundex
Calculate soundex key of a string by implementing the rules described on the wikipedia page Compliant, optimized and small package to get soundex key
For mapping and formula, see https://en.wikipedia.org/wiki/Soundex#American_Soundex
Install
yarn add @jellyfish-commuting/soundexor
npm install @jellyfish-commuting/soundexUsage
import soundex from '@jellyfish-commuting/soundex';
// Test 'Ashcraft' (it's a common error in soundex implementation)
console.log(soundex('Ashcraft')); // Output A261 (... not A226)
// Test equal phonetics
if (soundex('Robert') === soundex('Rupert')) {
  console.log('Equal soundex');
} else {
  console.log('Different soundex');
}
// Output : Equal soundexParams
soundex(str, length = 4);| Prop | Type | Default | Note | 
|---|---|---|---|
| str | string | Required field | Input value | 
| length | int | 4 | Length of soundex key | 
Return value
Soundex key of length chars