We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc1b73e commit ee2be5cCopy full SHA for ee2be5c
functions/strings/metaphone.js
@@ -5,6 +5,8 @@ function metaphone(word, phones) {
5
// improved by: Rafał Kukawski (http://kukawski.pl)
6
// example 1: metaphone('Gnu');
7
// returns 1: 'N'
8
+ // example 2: metaphone('bigger');
9
+ // returns 2: 'BKR'
10
11
word = (word == null ? '' : word + '')
12
.toUpperCase();
@@ -22,7 +24,7 @@ function metaphone(word, phones) {
22
24
for (var i = 1; i < wordlength; i++) {
23
25
char2 = word.charAt(i);
26
- if (char2 !== char1 || char2 === 'C' || char2 === 'G') { // 'c' and 'g' are exceptions
27
+ if (char2 !== char1 || char2 === 'C') { // 'c' is an exception
28
rebuilt += char2;
29
}
30
char1 = char2;
@@ -256,4 +258,4 @@ function metaphone(word, phones) {
256
258
return metaword.substr(0, phones);
257
259
260
return metaword;
-}
261
+}
0 commit comments