Run eslint autofixer on /lms
This commit is contained in:
@@ -33,30 +33,29 @@
|
||||
var _split; // instead of split for a less common name; avoid conflict
|
||||
|
||||
// Avoid running twice; that would break the `nativeSplit` reference
|
||||
_split = _split || function (undef) {
|
||||
|
||||
_split = _split || function(undef) {
|
||||
var nativeSplit = String.prototype.split,
|
||||
compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group
|
||||
compliantExecNpcg = /()??/.exec('')[1] === undef, // NPCG: nonparticipating capturing group
|
||||
self;
|
||||
|
||||
self = function (str, separator, limit) {
|
||||
self = function(str, separator, limit) {
|
||||
// If `separator` is not a regex, use `nativeSplit`
|
||||
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
|
||||
if (Object.prototype.toString.call(separator) !== '[object RegExp]') {
|
||||
return nativeSplit.call(str, separator, limit);
|
||||
}
|
||||
var output = [],
|
||||
flags = (separator.ignoreCase ? "i" : "") +
|
||||
(separator.multiline ? "m" : "") +
|
||||
(separator.extended ? "x" : "") + // Proposed for ES6
|
||||
(separator.sticky ? "y" : ""), // Firefox 3+
|
||||
flags = (separator.ignoreCase ? 'i' : '') +
|
||||
(separator.multiline ? 'm' : '') +
|
||||
(separator.extended ? 'x' : '') + // Proposed for ES6
|
||||
(separator.sticky ? 'y' : ''), // Firefox 3+
|
||||
lastLastIndex = 0,
|
||||
// Make `global` and avoid `lastIndex` issues by working with a copy
|
||||
separator = new RegExp(separator.source, flags + "g"),
|
||||
separator = new RegExp(separator.source, flags + 'g'),
|
||||
separator2, match, lastIndex, lastLength;
|
||||
str += ""; // Type-convert
|
||||
str += ''; // Type-convert
|
||||
if (!compliantExecNpcg) {
|
||||
// Doesn't need flags gy, but they don't hurt
|
||||
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
|
||||
separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags);
|
||||
}
|
||||
/* Values for `limit`, per the spec:
|
||||
* If undefined: 4294967295 // Math.pow(2, 32) - 1
|
||||
@@ -76,7 +75,7 @@ _split = _split || function (undef) {
|
||||
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
||||
// nonparticipating capturing groups
|
||||
if (!compliantExecNpcg && match.length > 1) {
|
||||
match[0].replace(separator2, function () {
|
||||
match[0].replace(separator2, function() {
|
||||
for (var i = 1; i < arguments.length - 2; i++) {
|
||||
if (arguments[i] === undef) {
|
||||
match[i] = undef;
|
||||
@@ -98,8 +97,8 @@ _split = _split || function (undef) {
|
||||
}
|
||||
}
|
||||
if (lastLastIndex === str.length) {
|
||||
if (lastLength || !separator.test("")) {
|
||||
output.push("");
|
||||
if (lastLength || !separator.test('')) {
|
||||
output.push('');
|
||||
}
|
||||
} else {
|
||||
output.push(str.slice(lastLastIndex));
|
||||
@@ -108,11 +107,10 @@ _split = _split || function (undef) {
|
||||
};
|
||||
|
||||
// For convenience
|
||||
String.prototype.split = function (separator, limit) {
|
||||
String.prototype.split = function(separator, limit) {
|
||||
return self(this, separator, limit);
|
||||
};
|
||||
|
||||
return self;
|
||||
|
||||
return self;
|
||||
}();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user