Merge pull request #1 from artemisbot/morse-fixes

Morse fixes
feature-extract-files
Toby Lorne 2017-02-03 22:00:55 -05:00 committed by GitHub
commit 718e1dc153
5 changed files with 172 additions and 18 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -93,8 +93,8 @@ var MorseCode = {
var dash = format[0];
var dot = format[1];
var letter_delim = MorseCode.OPTION_TABLE[args[1]];
var word_delim = MorseCode.OPTION_TABLE[args[2]];
var letterDelim = MorseCode.OPTION_TABLE[args[1]];
var wordDelim = MorseCode.OPTION_TABLE[args[2]];
input = input.split(/\r?\n/);
input = Array.prototype.map.call(input, function(line) {
@ -122,16 +122,16 @@ var MorseCode = {
switch(match) {
case "<dash>": return dash;
case "<dot>": return dot;
case "<ld>": return letter_delim;
case "<wd>": return word_delim;
case "<ld>": return letterDelim;
case "<wd>": return wordDelim;
}
}
);
return input;
},
/**
* From Morse Code operation.
*
@ -155,27 +155,26 @@ var MorseCode = {
reverseTable();
}
var letter_delim = MorseCode.OPTION_TABLE[args[0]];
var word_delim = MorseCode.OPTION_TABLE[args[1]];
var letterDelim = MorseCode.OPTION_TABLE[args[0]];
var wordDelim = MorseCode.OPTION_TABLE[args[1]];
input = input.replace(/-|_|dash/ig, "<dash>")
input = input.replace(/\.|dot/ig, "<dot>")
input = input.replace(/-|_|dash/ig, "<dash>");
input = input.replace(/\.|dot/ig, "<dot>");
var words = input.split(word_delim);
var words = input.split(wordDelim);
words = Array.prototype.map.call(words, function(word) {
var signals = word.split(letter_delim);
var signals = word.split(letterDelim);
var letters = signals.map(function(signal) {
return reversedTable[signal];
});
var word = letters.join("");
return word;
return letters.join("");
});
words = words.join(" ");
return words;
};
})(),
};

View File

@ -1,3 +1,30 @@
<<<<<<< HEAD
203 source files
<<<<<<< HEAD
<<<<<<< HEAD
104401 lines
size
136 JavaScript source files
95311 lines
3.4M size
=======
104403 lines
4.0M size
136 JavaScript source files
95313 lines
3.5M size
>>>>>>> master
=======
104466 lines
4.0M size
136 JavaScript source files
95316 lines
3.4M size
>>>>>>> master
=======
211 source files
114840 lines
4.3M size
@ -5,14 +32,30 @@
141 JavaScript source files
105680 lines
3.7M size
>>>>>>> master
83 third party JavaScript source files
86258 lines
3.0M size
58 first party JavaScript source files
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
18934 lines
729K size
=======
18936 lines
728K size
>>>>>>> master
=======
18939 lines
724K size
>>>>>>> master
=======
19422 lines
732K size
>>>>>>> master
3.4M uncompressed JavaScript size
1.9M compressed JavaScript size