mirror of
https://github.com/seejohnrun/haste-server.git
synced 2024-11-01 03:21:21 +00:00
phonetic keys can begin with vowel + added missing \'z\' to consontants
This commit is contained in:
parent
2deda5b68a
commit
028aa96b13
1 changed files with 3 additions and 2 deletions
|
@ -6,13 +6,14 @@ var PhoneticKeyGenerator = function(options) {
|
||||||
// Generate a phonetic key
|
// Generate a phonetic key
|
||||||
PhoneticKeyGenerator.prototype.createKey = function(keyLength) {
|
PhoneticKeyGenerator.prototype.createKey = function(keyLength) {
|
||||||
var text = '';
|
var text = '';
|
||||||
|
var start = Math.round(Math.random() * 2);
|
||||||
for (var i = 0; i < keyLength; i++) {
|
for (var i = 0; i < keyLength; i++) {
|
||||||
text += (i % 2 == 0) ? this.randConsonant() : this.randVowel();
|
text += (i % 2 == start) ? this.randConsonant() : this.randVowel();
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
PhoneticKeyGenerator.consonants = 'bcdfghjklmnpqrstvwxy';
|
PhoneticKeyGenerator.consonants = 'bcdfghjklmnpqrstvwxyz';
|
||||||
PhoneticKeyGenerator.vowels = 'aeiou';
|
PhoneticKeyGenerator.vowels = 'aeiou';
|
||||||
|
|
||||||
// Get an random vowel
|
// Get an random vowel
|
||||||
|
|
Loading…
Reference in a new issue