style: Prettify

This commit is contained in:
Mariusz Nowak
2019-06-14 11:26:34 +02:00
parent 3bdf66566c
commit af2657ec5d
484 changed files with 8353 additions and 9590 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype[require("es6-symbol").iterator] : require("./shim");
? Array.prototype[require("es6-symbol").iterator]
: require("./shim");
+1 -3
View File
@@ -4,6 +4,4 @@
var toPosInt = require("../../number/to-pos-integer");
module.exports = function (arr1, arr2) {
return toPosInt(arr1.length) - toPosInt(arr2.length);
};
module.exports = function (arr1, arr2) { return toPosInt(arr1.length) - toPosInt(arr2.length); };
-1
View File
@@ -3,7 +3,6 @@
var toPosInt = require("../../number/to-pos-integer")
, callable = require("../../object/valid-callable")
, value = require("../../object/valid-value")
, floor = Math.floor;
module.exports = function (compareFn) {
+1 -3
View File
@@ -7,7 +7,5 @@ var isValue = require("../../object/is-value");
var filter = Array.prototype.filter;
module.exports = function () {
return filter.call(this, function (val) {
return isValue(val);
});
return filter.call(this, function (val) { return isValue(val); });
};
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "concat", { value: require("./shim"),
Object.defineProperty(Array.prototype, "concat", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.concat : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.concat : require("./shim");
+1 -3
View File
@@ -2,6 +2,4 @@
var SubArray = require("../../_sub-array-dummy-safe");
module.exports = function () {
return (new SubArray()).concat("foo") instanceof SubArray;
};
module.exports = function () { return new SubArray().concat("foo") instanceof SubArray; };
+3 -7
View File
@@ -19,16 +19,14 @@ isSpreadable = function (value) {
};
// eslint-disable-next-line no-unused-vars
module.exports = function (item /*, …items*/) {
module.exports = function (item/*, …items*/) {
var result;
if (!this || !isArray(this) || isPlainArray(this)) {
return concat.apply(this, arguments);
}
result = new this.constructor();
if (isSpreadable(this)) {
forEach.call(this, function (val, i) {
result[i] = val;
});
forEach.call(this, function (val, i) { result[i] = val; });
} else {
result[0] = this;
}
@@ -37,9 +35,7 @@ module.exports = function (item /*, …items*/) {
if (isSpreadable(arg)) {
base = result.length;
result.length += toPosInt(arg.length);
forEach.call(arg, function (val, i) {
result[base + i] = val;
});
forEach.call(arg, function (val, i) { result[base + i] = val; });
return;
}
result.push(arg);
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.copyWithin : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.copyWithin : require("./shim");
+1 -1
View File
@@ -9,7 +9,7 @@ var toInteger = require("../../../number/to-integer")
, max = Math.max
, min = Math.min;
module.exports = function (target, start /*, end*/) {
module.exports = function (target, start/*, end*/) {
var arr = validValue(this)
, end = arguments[2]
, length = toPosInt(arr.length)
+1 -3
View File
@@ -7,7 +7,5 @@ var value = require("../../object/valid-value")
module.exports = function (other) {
value(this);
value(other);
return filter.call(this, function (item) {
return !contains.call(other, item);
});
return filter.call(this, function (item) { return !contains.call(other, item); });
};
+1 -1
View File
@@ -8,7 +8,7 @@ var numberIsNaN = require("../../number/is-nan")
, abs = Math.abs
, floor = Math.floor;
module.exports = function (searchElement /*, fromIndex*/) {
module.exports = function (searchElement/*, fromIndex*/) {
var i, length, fromIndex, val;
if (!numberIsNaN(searchElement)) return indexOf.apply(this, arguments);
+1 -1
View File
@@ -8,7 +8,7 @@ var numberIsNaN = require("../../number/is-nan")
, abs = Math.abs
, floor = Math.floor;
module.exports = function (searchElement /*, fromIndex*/) {
module.exports = function (searchElement/*, fromIndex*/) {
var i, fromIndex, val;
if (!numberIsNaN(searchElement)) {
// Jslint: ignore
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "entries", { value: require("./shim"),
Object.defineProperty(Array.prototype, "entries", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.entries : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.entries : require("./shim");
+1 -3
View File
@@ -1,6 +1,4 @@
"use strict";
var ArrayIterator = require("es6-iterator/array");
module.exports = function () {
return new ArrayIterator(this, "key+value");
};
module.exports = function () { return new ArrayIterator(this, "key+value"); };
+3 -9
View File
@@ -11,20 +11,14 @@ var value = require("../../object/valid-value")
module.exports = function (/* …lists*/) {
var lists, seen, result;
if (!arguments.length) return aFrom(this);
push.apply(lists = [this], arguments);
push.apply((lists = [this]), arguments);
lists.forEach(value);
seen = [];
result = [];
lists.sort(byLength).forEach(function (list) {
result = result
.filter(function (item) {
return !contains.call(list, item);
})
.concat(
filter.call(list, function (item) {
return !contains.call(seen, item);
})
);
.filter(function (item) { return !contains.call(list, item); })
.concat(filter.call(list, function (item) { return !contains.call(seen, item); }));
push.apply(seen, toArray(list));
});
return result;
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "fill", { value: require("./shim"),
Object.defineProperty(Array.prototype, "fill", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.fill : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.fill : require("./shim");
+1 -1
View File
@@ -8,7 +8,7 @@ var toInteger = require("../../../number/to-integer")
, max = Math.max
, min = Math.min;
module.exports = function (value /*, start, end*/) {
module.exports = function (value/*, start, end*/) {
var arr = validValue(this)
, start = arguments[1]
, end = arguments[2]
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "filter", { value: require("./shim"),
Object.defineProperty(Array.prototype, "filter", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.filter : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.filter : require("./shim");
+2 -7
View File
@@ -1,11 +1,6 @@
"use strict";
var SubArray = require("../../_sub-array-dummy-safe")
, pass = function () { return true; };
, pass = function () {
return true;
};
module.exports = function () {
return (new SubArray()).filter(pass) instanceof SubArray;
};
module.exports = function () { return new SubArray().filter(pass) instanceof SubArray; };
+1 -1
View File
@@ -7,7 +7,7 @@ var isPlainArray = require("../../is-plain-array")
, forEach = Array.prototype.forEach
, call = Function.prototype.call;
module.exports = function (callbackFn /*, thisArg*/) {
module.exports = function (callbackFn/*, thisArg*/) {
var result, thisArg, i;
if (!this || !isArray(this) || isPlainArray(this)) {
return filter.apply(this, arguments);
+5 -4
View File
@@ -1,9 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "findIndex",
{ value: require("./shim"),
Object.defineProperty(Array.prototype, "findIndex", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.findIndex : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.findIndex : require("./shim");
+1 -3
View File
@@ -1,8 +1,6 @@
"use strict";
var fn = function (value) {
return value > 3;
};
var fn = function (value) { return value > 3; };
module.exports = function () {
var arr = [1, 2, 3, 4, 5, 6];
+1 -1
View File
@@ -5,7 +5,7 @@ var callable = require("../../../object/valid-callable")
, some = Array.prototype.some
, apply = Function.prototype.apply;
module.exports = function (predicate /*, thisArg*/) {
module.exports = function (predicate/*, thisArg*/) {
var k, self;
self = Object(ensureValue(this));
callable(predicate);
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "find", { value: require("./shim"),
Object.defineProperty(Array.prototype, "find", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.find : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.find : require("./shim");
+1 -3
View File
@@ -1,8 +1,6 @@
"use strict";
var fn = function (value) {
return value > 3;
};
var fn = function (value) { return value > 3; };
module.exports = function () {
var arr = [1, 2, 3, 4, 5, 6];
+1 -1
View File
@@ -3,7 +3,7 @@
var findIndex = require("../find-index/shim");
// eslint-disable-next-line no-unused-vars
module.exports = function (predicate /*, thisArg*/) {
module.exports = function (predicate/*, thisArg*/) {
var index = findIndex.apply(this, arguments);
return index === -1 ? undefined : this[index];
};
+1 -1
View File
@@ -6,7 +6,7 @@ var toPosInt = require("../../number/to-pos-integer")
, objHasOwnProperty = Object.prototype.hasOwnProperty
, call = Function.prototype.call;
module.exports = function (cb /*, thisArg*/) {
module.exports = function (cb/*, thisArg*/) {
var i, self, thisArg;
self = Object(value(this));
+1 -1
View File
@@ -8,7 +8,7 @@ var callable = require("../../object/valid-callable")
, forEach = Array.prototype.forEach
, apply = Function.prototype.apply;
module.exports = function (cb /*, thisArg*/) {
module.exports = function (cb/*, thisArg*/) {
var result;
value(this);
+1 -1
View File
@@ -2,7 +2,7 @@
var indexOf = require("./e-index-of");
module.exports = function (value /*, fromIndex*/) {
module.exports = function (value/*, fromIndex*/) {
var result = [], i, fromIndex = arguments[1];
while ((i = indexOf.call(this, value, fromIndex)) !== -1) {
result.push(i);
+2 -4
View File
@@ -10,12 +10,10 @@ var value = require("../../object/valid-value")
module.exports = function (/* …list*/) {
var lists;
if (!arguments.length) slice.call(this);
push.apply(lists = [this], arguments);
push.apply((lists = [this]), arguments);
lists.forEach(value);
lists.sort(byLength);
return lists.reduce(function (list1, list2) {
return filter.call(list1, function (item) {
return contains.call(list2, item);
});
return filter.call(list1, function (item) { return contains.call(list2, item); });
});
};
+1 -3
View File
@@ -3,6 +3,4 @@
var ensureArray = require("../../object/ensure-array")
, firstIndex = require("./first-index");
module.exports = function () {
return firstIndex.call(ensureArray(this)) === null;
};
module.exports = function () { return firstIndex.call(ensureArray(this)) === null; };
+2 -7
View File
@@ -1,14 +1,9 @@
"use strict";
var indexOf = require("./e-index-of")
, every = Array.prototype.every
, isFirst;
isFirst = function (value, index) {
return indexOf.call(this, value) === index;
};
isFirst = function (value, index) { return indexOf.call(this, value) === index; };
module.exports = function () {
return every.call(this, isFirst, this);
};
module.exports = function () { return every.call(this, isFirst, this); };
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "keys", { value: require("./shim"),
Object.defineProperty(Array.prototype, "keys", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.keys : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.keys : require("./shim");
+1 -3
View File
@@ -1,6 +1,4 @@
"use strict";
var ArrayIterator = require("es6-iterator/array");
module.exports = function () {
return new ArrayIterator(this, "key");
};
module.exports = function () { return new ArrayIterator(this, "key"); };
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "map", { value: require("./shim"),
Object.defineProperty(Array.prototype, "map", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.map : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.map : require("./shim");
+1 -3
View File
@@ -3,6 +3,4 @@
var identity = require("../../../function/identity")
, SubArray = require("../../_sub-array-dummy-safe");
module.exports = function () {
return (new SubArray()).map(identity) instanceof SubArray;
};
module.exports = function () { return new SubArray().map(identity) instanceof SubArray; };
+4 -3
View File
@@ -2,9 +2,10 @@
var isPlainArray = require("../../is-plain-array")
, callable = require("../../../object/valid-callable")
, isArray = Array.isArray, map = Array.prototype.map
, forEach = Array.prototype.forEach, call = Function.prototype.call;
, isArray = Array.isArray
, map = Array.prototype.map
, forEach = Array.prototype.forEach
, call = Function.prototype.call;
module.exports = function (callbackFn/*, thisArg*/) {
var result, thisArg;
+1 -1
View File
@@ -5,7 +5,7 @@ var indexOf = require("./e-index-of")
, splice = Array.prototype.splice;
// eslint-disable-next-line no-unused-vars
module.exports = function (itemToRemove /*, …item*/) {
module.exports = function (itemToRemove/*, …item*/) {
forEach.call(
arguments,
function (item) {
+1 -3
View File
@@ -4,9 +4,7 @@ var forEach = Array.prototype.forEach;
module.exports = function (sep) {
var result = [];
forEach.call(this, function (val) {
result.push(val, sep);
});
forEach.call(this, function (val) { result.push(val, sep); });
result.pop();
return result;
};
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "slice", { value: require("./shim"),
Object.defineProperty(Array.prototype, "slice", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.slice : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.slice : require("./shim");
+1 -3
View File
@@ -2,6 +2,4 @@
var SubArray = require("../../_sub-array-dummy-safe");
module.exports = function () {
return (new SubArray()).slice() instanceof SubArray;
};
module.exports = function () { return new SubArray().slice() instanceof SubArray; };
+1 -1
View File
@@ -6,7 +6,7 @@ var toPosInt = require("../../number/to-pos-integer")
, objHasOwnProperty = Object.prototype.hasOwnProperty
, call = Function.prototype.call;
module.exports = function (cb /*, thisArg*/) {
module.exports = function (cb/*, thisArg*/) {
var i, self, thisArg;
self = Object(value(this));
callable(cb);
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "splice", { value: require("./shim"),
Object.defineProperty(Array.prototype, "splice", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -2
View File
@@ -1,4 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.prototype.splice : require("./shim");
module.exports = require("./is-implemented")() ? Array.prototype.splice : require("./shim");
+1 -3
View File
@@ -2,6 +2,4 @@
var SubArray = require("../../_sub-array-dummy-safe");
module.exports = function () {
return (new SubArray()).splice(0) instanceof SubArray;
};
module.exports = function () { return new SubArray().splice(0) instanceof SubArray; };
+2 -4
View File
@@ -6,12 +6,10 @@ var isPlainArray = require("../../is-plain-array")
, forEach = Array.prototype.forEach;
// eslint-disable-next-line no-unused-vars
module.exports = function (start, deleteCount /*, …items*/) {
module.exports = function (start, deleteCount/*, …items*/) {
var arr = splice.apply(this, arguments), result;
if (!this || !isArray(this) || isPlainArray(this)) return arr;
result = new this.constructor(arr.length);
forEach.call(arr, function (val, i) {
result[i] = val;
});
forEach.call(arr, function (val, i) { result[i] = val; });
return result;
};
+2 -8
View File
@@ -1,15 +1,9 @@
"use strict";
var indexOf = require("./e-index-of")
, filter = Array.prototype.filter
, isFirst;
isFirst = function (value, index) {
return indexOf.call(this, value) === index;
};
isFirst = function (value, index) { return indexOf.call(this, value) === index; };
module.exports = function () {
return filter.call(this, isFirst, this);
};
module.exports = function () { return filter.call(this, isFirst, this); };
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array.prototype, "values", { value: require("./shim"),
Object.defineProperty(Array.prototype, "values", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,6 +1,4 @@
"use strict";
var ArrayIterator = require("es6-iterator/array");
module.exports = function () {
return new ArrayIterator(this, "value");
};
module.exports = function () { return new ArrayIterator(this, "value"); };
+3 -2
View File
@@ -1,7 +1,8 @@
"use strict";
module.exports = (function () {
var SubArray = require("./_sub-array-dummy"), arr;
var SubArray = require("./_sub-array-dummy")
, arr;
if (!SubArray) return false;
arr = new SubArray();
@@ -10,4 +11,4 @@ module.exports = (function () {
arr[34] = "foo";
return arr.length === 35;
}());
})();
+2 -5
View File
@@ -16,10 +16,7 @@ module.exports = (function () {
};
setPrototypeOf(SubArray, Array);
SubArray.prototype = Object.create(Array.prototype, {
constructor: { value: SubArray,
enumerable: false,
writable: true,
configurable: true }
constructor: { value: SubArray, enumerable: false, writable: true, configurable: true }
});
return SubArray;
}());
})();
+3 -8
View File
@@ -6,15 +6,10 @@ module.exports = (function () {
var SubArray;
if (!setPrototypeOf) return null;
SubArray = function () {
Array.apply(this, arguments);
};
SubArray = function () { Array.apply(this, arguments); };
setPrototypeOf(SubArray, Array);
SubArray.prototype = Object.create(Array.prototype, {
constructor: { value: SubArray,
enumerable: false,
writable: true,
configurable: true }
constructor: { value: SubArray, enumerable: false, writable: true, configurable: true }
});
return SubArray;
}());
})();
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array, "from", { value: require("./shim"),
Object.defineProperty(Array, "from", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.from
: require("./shim");
module.exports = require("./is-implemented")() ? Array.from : require("./shim");
+1 -1
View File
@@ -5,5 +5,5 @@ module.exports = function () {
if (typeof from !== "function") return false;
arr = ["raz", "dwa"];
result = from(arr);
return Boolean(result && (result !== arr) && (result[1] === "dwa"));
return Boolean(result && result !== arr && result[1] === "dwa");
};
+2 -2
View File
@@ -14,7 +14,7 @@ var iteratorSymbol = require("es6-symbol").iterator
, defineProperty = Object.defineProperty;
// eslint-disable-next-line complexity, max-lines-per-function
module.exports = function (arrayLike /*, mapFn, thisArg*/) {
module.exports = function (arrayLike/*, mapFn, thisArg*/) {
var mapFn = arguments[1]
, thisArg = arguments[2]
, Context
@@ -44,7 +44,7 @@ module.exports = function (arrayLike /*, mapFn, thisArg*/) {
}
if (isArray(arrayLike)) {
// Source: Array
arr = new Array(length = arrayLike.length);
arr = new Array((length = arrayLike.length));
for (i = 0; i < length; ++i) arr[i] = arrayLike[i];
return arr;
}
+1 -1
View File
@@ -4,7 +4,7 @@ var toPosInt = require("../number/to-pos-integer")
, value = require("../object/valid-value")
, slice = Array.prototype.slice;
module.exports = function (length /*, …fill*/) {
module.exports = function (length/*, …fill*/) {
var arr, currentLength;
length = toPosInt(value(length));
if (length === 0) return [];
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Array, "of", { value: require("./shim"),
Object.defineProperty(Array, "of", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Array.of
: require("./shim");
module.exports = require("./is-implemented")() ? Array.of : require("./shim");
+1 -1
View File
@@ -4,5 +4,5 @@ module.exports = function () {
var of = Array.of, result;
if (typeof of !== "function") return false;
result = of("foo", "bar");
return Boolean(result && (result[1] === "bar"));
return Boolean(result && result[1] === "bar");
};
+1 -1
View File
@@ -8,7 +8,7 @@ var isFunction = require("../../function/is-function")
module.exports = function (/* …items*/) {
var result, i, length;
if (!this || this === Array || !isFunction(this)) return slice.call(arguments);
result = new this(length = arguments.length);
result = new this((length = arguments.length));
for (i = 0; i < length; ++i) {
desc.value = arguments[i];
defineProperty(result, i, desc);
+1 -4
View File
@@ -1,9 +1,6 @@
"use strict";
var from = require("./from")
, isArray = Array.isArray;
module.exports = function (arrayLike) {
return isArray(arrayLike) ? arrayLike : from(arrayLike);
};
module.exports = function (arrayLike) { return isArray(arrayLike) ? arrayLike : from(arrayLike); };
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = {
isBoolean: require("./is-boolean")
};
module.exports = { isBoolean: require("./is-boolean") };
+1 -3
View File
@@ -2,6 +2,4 @@
var getTime = Date.prototype.getTime;
module.exports = function () {
return new Date(getTime.call(this));
};
module.exports = function () { return new Date(getTime.call(this)); };
+9 -27
View File
@@ -7,32 +7,14 @@ var pad = require("../../number/#/pad")
, format;
format = require("../../string/format-method")({
Y: function () {
return String(this.getFullYear());
},
y: function () {
return String(this.getFullYear()).slice(-2);
},
m: function () {
return pad.call(this.getMonth() + 1, 2);
},
d: function () {
return pad.call(this.getDate(), 2);
},
H: function () {
return pad.call(this.getHours(), 2);
},
M: function () {
return pad.call(this.getMinutes(), 2);
},
S: function () {
return pad.call(this.getSeconds(), 2);
},
L: function () {
return pad.call(this.getMilliseconds(), 3);
}
Y: function () { return String(this.getFullYear()); },
y: function () { return String(this.getFullYear()).slice(-2); },
m: function () { return pad.call(this.getMonth() + 1, 2); },
d: function () { return pad.call(this.getDate(), 2); },
H: function () { return pad.call(this.getHours(), 2); },
M: function () { return pad.call(this.getMinutes(), 2); },
S: function () { return pad.call(this.getSeconds(), 2); },
L: function () { return pad.call(this.getMilliseconds(), 3); }
});
module.exports = function (pattern) {
return format.call(date(this), pattern);
};
module.exports = function (pattern) { return format.call(date(this), pattern); };
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = {
throw: require("./throw")
};
module.exports = { throw: require("./throw") };
+1 -3
View File
@@ -2,6 +2,4 @@
var error = require("../valid-error");
module.exports = function () {
throw error(this);
};
module.exports = function () { throw error(this); };
+1 -1
View File
@@ -5,7 +5,7 @@ var assign = require("../object/assign")
, isValue = require("../object/is-value")
, captureStackTrace = Error.captureStackTrace;
exports = module.exports = function (message /*, code, ext*/) {
exports = module.exports = function (message/*, code, ext*/) {
var err = new Error(message), code = arguments[1], ext = arguments[2];
if (!isValue(ext)) {
if (isObject(code)) {
+2 -3
View File
@@ -16,8 +16,7 @@ module.exports = function () {
match[2] +
") { return fn.apply(this, arguments); };"
)(this);
try {
mixin(fn, this);
} catch (ignore) {}
try { mixin(fn, this); }
catch (ignore) {}
return fn;
};
+9 -8
View File
@@ -3,22 +3,23 @@
var toPosInt = require("../../number/to-pos-integer")
, callable = require("../../object/valid-callable")
, defineLength = require("../_define-length")
, slice = Array.prototype.slice, apply = Function.prototype.apply
, slice = Array.prototype.slice
, apply = Function.prototype.apply
, curry;
curry = function self(fn, length, preArgs) {
return defineLength(function () {
return defineLength(
function () {
var args = preArgs
? preArgs.concat(slice.call(arguments, 0, length - preArgs.length))
: slice.call(arguments, 0, length);
return args.length === length ? apply.call(fn, this, args)
: self(fn, length, args);
}, preArgs ? length - preArgs.length : length);
return args.length === length ? apply.call(fn, this, args) : self(fn, length, args);
},
preArgs ? length - preArgs.length : length
);
};
module.exports = function (/* Length*/) {
var length = arguments[0];
return curry(callable(this),
isNaN(length) ? toPosInt(this.length) : toPosInt(length));
return curry(callable(this), isNaN(length) ? toPosInt(this.length) : toPosInt(length));
};
+2 -6
View File
@@ -1,14 +1,10 @@
"use strict";
var callable = require("../../object/valid-callable")
, apply = Function.prototype.apply;
module.exports = function (/* …args*/) {
var fn = callable(this)
, args = arguments;
var fn = callable(this), args = arguments;
return function () {
return apply.call(fn, this, args);
};
return function () { return apply.call(fn, this, args); };
};
+1 -3
View File
@@ -8,7 +8,5 @@ var apply = Function.prototype.apply;
module.exports = function () {
var src = ensurePlainFunction(this);
return defineLength(function () {
nextTick(apply.bind(src, this, arguments));
}, this.length);
return defineLength(function () { nextTick(apply.bind(src, this, arguments)); }, this.length);
};
+1 -4
View File
@@ -2,13 +2,10 @@
var callable = require("../../object/valid-callable")
, defineLength = require("../_define-length")
, apply = Function.prototype.apply;
module.exports = function () {
var fn = callable(this);
return defineLength(function () {
return !apply.call(fn, this, arguments);
}, fn.length);
return defineLength(function () { return !apply.call(fn, this, arguments); }, fn.length);
};
+1 -3
View File
@@ -3,12 +3,10 @@
var callable = require("../../object/valid-callable")
, aFrom = require("../../array/from")
, defineLength = require("../_define-length")
, apply = Function.prototype.apply;
module.exports = function (/* …args*/) {
var fn = callable(this)
, args = aFrom(arguments);
var fn = callable(this), args = aFrom(arguments);
return defineLength(function () {
return apply.call(fn, this, args.concat(aFrom(arguments)));
+1 -4
View File
@@ -1,12 +1,9 @@
"use strict";
var callable = require("../../object/valid-callable")
, apply = Function.prototype.apply;
module.exports = function () {
var fn = callable(this);
return function (args) {
return apply.call(fn, this, args);
};
return function (args) { return apply.call(fn, this, args); };
};
+6 -8
View File
@@ -2,9 +2,7 @@
var toPosInt = require("../number/to-pos-integer");
var test = function (arg1, arg2) {
return arg2;
};
var test = function (arg1, arg2) { return arg2; };
var desc, defineProperty, generate, mixin;
@@ -15,7 +13,8 @@ try {
enumerable: false,
value: 1
});
} catch (ignore) {}
}
catch (ignore) {}
if (test.length === 1) {
// ES6
@@ -42,15 +41,14 @@ if (test.length === 1) {
"return function (" + args.join(", ") + ") { return fn.apply(this, arguments); };"
);
};
}());
})();
module.exports = function (src, length) {
var target;
length = toPosInt(length);
if (src.length === length) return src;
target = generate(length)(src);
try {
mixin(target, src);
} catch (ignore) {}
try { mixin(target, src); }
catch (ignore) {}
return target;
};
}
+1 -3
View File
@@ -1,7 +1,5 @@
"use strict";
module.exports = function (value) {
return function () {
return value;
};
return function () { return value; };
};
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = function (value) {
return value;
};
module.exports = function (value) { return value; };
+3 -4
View File
@@ -2,14 +2,13 @@
var isCallable = require("../object/is-callable")
, value = require("../object/valid-value")
, slice = Array.prototype.slice, apply = Function.prototype.apply;
, slice = Array.prototype.slice
, apply = Function.prototype.apply;
module.exports = function (name/*, …args*/) {
var args = slice.call(arguments, 1), isFn = isCallable(name);
return function (obj) {
value(obj);
return apply.call(isFn ? name : obj[name], obj,
args.concat(slice.call(arguments, 1)));
return apply.call(isFn ? name : obj[name], obj, args.concat(slice.call(arguments, 1)));
};
};
+2 -8
View File
@@ -1,12 +1,6 @@
"use strict";
var objToString = Object.prototype.toString
, id = objToString.call(
(function () {
return arguments;
})()
);
, id = objToString.call((function () { return arguments; })());
module.exports = function (value) {
return objToString.call(value) === id;
};
module.exports = function (value) { return objToString.call(value) === id; };
+2 -1
View File
@@ -1,6 +1,7 @@
"use strict";
var objToString = Object.prototype.toString, id = objToString.call(require("./noop"));
var objToString = Object.prototype.toString
, id = objToString.call(require("./noop"));
module.exports = function (value) {
return typeof value === "function" && objToString.call(value) === id;
+1 -3
View File
@@ -3,7 +3,5 @@
var value = require("../object/valid-value");
module.exports = function (name) {
return function (obj) {
return value(obj)[name];
};
return function (obj) { return value(obj)[name]; };
};
-1
View File
@@ -3,7 +3,6 @@
var forOf = require("es6-iterator/for-of")
, isIterable = require("es6-iterator/is-iterable")
, iterable = require("./validate")
, forEach = Array.prototype.forEach;
module.exports = function (target, cb/*, thisArg*/) {
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = {
safeStringify: require("./safe-stringify")
};
module.exports = { safeStringify: require("./safe-stringify") };
+2 -6
View File
@@ -6,7 +6,7 @@ var compact = require("../array/#/compact")
, isArray = Array.isArray
, stringify = JSON.stringify;
module.exports = function self(value /*, replacer, space*/) {
module.exports = function self(value/*, replacer, space*/) {
var replacer = arguments[1], space = arguments[2];
try {
return stringify(value, replacer, space);
@@ -16,11 +16,7 @@ module.exports = function self(value /*, replacer, space*/) {
if (isArray(value)) {
return (
"[" +
compact.call(
value.map(function (item) {
return self(item, replacer, space);
})
) +
compact.call(value.map(function (item) { return self(item, replacer, space); })) +
"]"
);
}
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Math, "acosh", { value: require("./shim"),
Object.defineProperty(Math, "acosh", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Math.acosh
: require("./shim");
module.exports = require("./is-implemented")() ? Math.acosh : require("./shim");
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Math, "asinh", { value: require("./shim"),
Object.defineProperty(Math, "asinh", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Math.asinh
: require("./shim");
module.exports = require("./is-implemented")() ? Math.asinh : require("./shim");
+5 -3
View File
@@ -1,8 +1,10 @@
"use strict";
if (!require("./is-implemented")()) {
Object.defineProperty(Math, "atanh", { value: require("./shim"),
Object.defineProperty(Math, "atanh", {
value: require("./shim"),
configurable: true,
enumerable: false,
writable: true });
enumerable: false,
writable: true
});
}
+1 -3
View File
@@ -1,5 +1,3 @@
"use strict";
module.exports = require("./is-implemented")()
? Math.atanh
: require("./shim");
module.exports = require("./is-implemented")() ? Math.atanh : require("./shim");

Some files were not shown because too many files have changed in this diff Show More