1.0.6 • Published 4 years ago

@jellyfish-commuting/soundex v1.0.6

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

Version Licence Build Coverage Downloads

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/soundex

or

npm install @jellyfish-commuting/soundex

Usage

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 soundex

Params

soundex(str, length = 4);
PropTypeDefaultNote
strstringRequired fieldInput value
lengthint4Length of soundex key

Return value

Soundex key of length chars

1.0.6

4 years ago

1.0.5

4 years ago