1.0.4 • Published 4 years ago

@thejellyfish/soundex v1.0.4

Weekly downloads
-
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 @thejellyfish/soundex

or

npm install @thejellyfish/soundex

Usage

import soundex from '@thejellyfish/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.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago