This is Lawrence Philips's metaphone3 implementation ported/transpiled using cincheo/jsweet.
You can find the original in OpenRefine's repo here
npm install metaphone3
import { metaphone3 } from '.';
metaphone3('Amin'); // => [ 'AMN', undefined ]
metaphone3('iron'); // => [ 'ARN', undefined ]
metaphone3('witz'); // => [ 'TS', 'FX' ]
metaphone3(''); // => [ '', undefined ]
metaphone3('VILLASENOR'); // => [ 'FLSNR', 'FSNR' ]
metaphone3('GUILLERMINA'); // => [ 'KRMN', undefined ]
metaphone3('PADILLA'); // => [ 'PTL', 'PT' ]
metaphone3('BJORK'); // => [ 'PRK', undefined ]
metaphone3('belle'); // => [ 'PL', undefined ]
metaphone3('ERICH'); // => [ 'ARK', 'ARX' ]
metaphone3('CROCE'); // => [ 'KRX', 'KRS' ]
metaphone3('GLOWACKI'); // => [ 'KLK', 'KLFSK' ]
metaphone3('qing'); // => [ 'XNK', undefined ]
metaphone3('tsing'); // => [ 'XNK', undefined ]
metaphone3('Guillermo', { encodeExact: true, encodeVowels: true });
// => [ 'GARMA', undefined ]