| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1 1 11051 11050 310 9 301 | 'use strict';
var
spaceAfter = /,[a-zA-Z]/,
spaceAfterNum = /,(?:\d*\.)?\d+/;
// check that commas are followed by spaces
module.exports = function checkCommaStyle( line ) {
if ( typeof line !== 'string' ) { return; }
// if , is present on line
if ( line.indexOf(',') !== -1 && line.indexOf(',') !== line.length - 1 ) {
// if no space after or space below
if ( spaceAfter.test(line) || spaceAfterNum.test(line) ) {
return false;
}
else {
return true;
}
}
} |