Fixed JavaScript "no-multi-spaces" violations.

This commit is contained in:
Tim Graham 2015-07-17 12:02:17 -04:00
parent efc144aba0
commit f8304ac33b
2 changed files with 15 additions and 8 deletions

View File

@ -16,7 +16,7 @@
"no-alert": [0], "no-alert": [0],
"no-eval": [1], "no-eval": [1],
"no-extend-native": [2, {"exceptions": ["Date", "String"]}], "no-extend-native": [2, {"exceptions": ["Date", "String"]}],
"no-multi-spaces": [1], "no-multi-spaces": [2],
"no-octal-escape": [1], "no-octal-escape": [1],
"no-underscore-dangle": [1], "no-underscore-dangle": [1],
"no-unused-vars": [2, {"vars": "local", "args": "none"}], "no-unused-vars": [2, {"vars": "local", "args": "none"}],

View File

@ -1,6 +1,7 @@
var timeParsePatterns = [ var timeParsePatterns = [
// 9 // 9
{ re: /^\d{1,2}$/i, {
re: /^\d{1,2}$/i,
handler: function(bits) { handler: function(bits) {
if (bits[0].length === 1) { if (bits[0].length === 1) {
return '0' + bits[0] + ':00'; return '0' + bits[0] + ':00';
@ -10,19 +11,22 @@ var timeParsePatterns = [
} }
}, },
// 13:00 // 13:00
{ re: /^\d{2}[:.]\d{2}$/i, {
re: /^\d{2}[:.]\d{2}$/i,
handler: function(bits) { handler: function(bits) {
return bits[0].replace('.', ':'); return bits[0].replace('.', ':');
} }
}, },
// 9:00 // 9:00
{ re: /^\d[:.]\d{2}$/i, {
re: /^\d[:.]\d{2}$/i,
handler: function(bits) { handler: function(bits) {
return '0' + bits[0].replace('.', ':'); return '0' + bits[0].replace('.', ':');
} }
}, },
// 3 am / 3 a.m. / 3am // 3 am / 3 a.m. / 3am
{ re: /^(\d+)\s*([ap])(?:.?m.?)?$/i, {
re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
handler: function(bits) { handler: function(bits) {
var hour = parseInt(bits[1]); var hour = parseInt(bits[1]);
if (hour === 12) { if (hour === 12) {
@ -43,7 +47,8 @@ var timeParsePatterns = [
} }
}, },
// 3.30 am / 3:15 a.m. / 3.00am // 3.30 am / 3:15 a.m. / 3.00am
{ re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i, {
re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
handler: function(bits) { handler: function(bits) {
var hour = parseInt(bits[1]); var hour = parseInt(bits[1]);
var mins = parseInt(bits[2]); var mins = parseInt(bits[2]);
@ -68,13 +73,15 @@ var timeParsePatterns = [
} }
}, },
// noon // noon
{ re: /^no/i, {
re: /^no/i,
handler: function(bits) { handler: function(bits) {
return '12:00'; return '12:00';
} }
}, },
// midnight // midnight
{ re: /^mid/i, {
re: /^mid/i,
handler: function(bits) { handler: function(bits) {
return '00:00'; return '00:00';
} }