Comparing version 1.46.2 to 1.47.0
@@ -55,3 +55,3 @@ "use strict"; | ||
var direction = typeof primaryRule === "function" ? "asc" : primaryRule[1]; | ||
var comparator = COMPARATORS[direction]; | ||
var _a = COMPARATORS, _b = direction, comparator = _a[_b]; | ||
var nextComparer = secondaryRule === undefined | ||
@@ -58,0 +58,0 @@ ? undefined |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -18,3 +9,3 @@ exports.quickSelect = void 0; | ||
undefined | ||
: quickSelectImplementation(__spreadArray([], data, true), 0, data.length - 1, index, compareFn); | ||
: quickSelectImplementation(data.slice(), 0, data.length - 1, index, compareFn); | ||
}; | ||
@@ -38,3 +29,3 @@ exports.quickSelect = quickSelect; | ||
(0, _swapInPlace_1.swapInPlace)(data, i, j); | ||
i++; | ||
i += 1; | ||
} | ||
@@ -41,0 +32,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._reduceLazy = void 0; | ||
function _reduceLazy(array, lazy, indexed) { | ||
var newArray = []; | ||
function _reduceLazy(array, lazy, isIndexed) { | ||
if (isIndexed === void 0) { isIndexed = false; } | ||
var out = []; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var result = indexed ? lazy(item, index, array) : lazy(item); | ||
var result = isIndexed ? lazy(item, index, array) : lazy(item); | ||
if (result.hasMany === true) { | ||
newArray.push.apply(newArray, result.next); | ||
out.push.apply(out, result.next); | ||
} | ||
else if (result.hasNext) { | ||
newArray.push(result.next); | ||
out.push(result.next); | ||
} | ||
if (result.done) { | ||
break; | ||
} | ||
} | ||
return newArray; | ||
return out; | ||
} | ||
exports._reduceLazy = _reduceLazy; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._toSingle = void 0; | ||
var _toSingle = function (fn) { | ||
return Object.assign(fn, { single: true }); | ||
}; | ||
var _toSingle = function (fn) { return Object.assign(fn, { single: true }); }; | ||
exports._toSingle = _toSingle; |
@@ -13,3 +13,3 @@ "use strict"; | ||
}); | ||
for (var index = 0; index < ret.length; index += 1) { | ||
for (var index = 0; index < ret.length; index++) { | ||
ret[index] = array.slice(index * size, (index + 1) * size); | ||
@@ -16,0 +16,0 @@ } |
@@ -9,14 +9,9 @@ "use strict"; | ||
exports.clamp = clamp; | ||
function _clamp(value, limits) { | ||
if (limits.min != null) { | ||
if (limits.min > value) { | ||
return limits.min; | ||
} | ||
} | ||
if (limits.max != null) { | ||
if (limits.max < value) { | ||
return limits.max; | ||
} | ||
} | ||
return value; | ||
function _clamp(value, _a) { | ||
var min = _a.min, max = _a.max; | ||
return min !== undefined && value < min | ||
? min | ||
: max !== undefined && value > max | ||
? max | ||
: value; | ||
} |
@@ -7,6 +7,9 @@ "use strict"; | ||
return function (array, fn) { | ||
return array.reduce(function (ret, item, index) { | ||
var out = 0; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var value = indexed ? fn(item, index, array) : fn(item); | ||
return ret + (value ? 1 : 0); | ||
}, 0); | ||
out += value ? 1 : 0; | ||
} | ||
return out; | ||
}; | ||
@@ -13,0 +16,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.difference = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function difference() { | ||
@@ -18,13 +18,5 @@ return (0, purry_1.purry)(_difference, arguments, difference.lazy); | ||
return function (value) { | ||
if (!set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return set.has(value) | ||
? { done: false, hasNext: false } | ||
: { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -31,0 +23,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.differenceWith = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function differenceWith() { | ||
@@ -15,18 +15,9 @@ return (0, purry_1.purry)(_differenceWith, arguments, differenceWith.lazy); | ||
(function (differenceWith) { | ||
function lazy(other, isEquals) { | ||
differenceWith.lazy = function (other, isEquals) { | ||
return function (value) { | ||
if (other.every(function (otherValue) { return !isEquals(value, otherValue); })) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return other.every(function (otherValue) { return !isEquals(value, otherValue); }) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
differenceWith.lazy = lazy; | ||
}; | ||
})(differenceWith || (exports.differenceWith = differenceWith = {})); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.drop = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function drop() { | ||
@@ -18,13 +18,6 @@ return (0, purry_1.purry)(_drop, arguments, drop.lazy); | ||
if (left > 0) { | ||
left--; | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
left -= 1; | ||
return { done: false, hasNext: false }; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -31,0 +24,0 @@ } |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -24,3 +15,3 @@ exports.dropFirstBy = void 0; | ||
if (n <= 0) { | ||
return __spreadArray([], data, true); | ||
return data.slice(); | ||
} | ||
@@ -27,0 +18,0 @@ var heap = data.slice(0, n); |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,3 +10,3 @@ exports.dropLast = void 0; | ||
function _dropLast(array, n) { | ||
var copy = __spreadArray([], array, true); | ||
var copy = array.slice(); | ||
if (n > 0) { | ||
@@ -22,0 +13,0 @@ copy.splice(-n); |
@@ -5,4 +5,2 @@ "use strict"; | ||
var purry_1 = require("./purry"); | ||
var isArray = Array.isArray; | ||
var keyList = Object.keys; | ||
function equals() { | ||
@@ -16,58 +14,57 @@ return (0, purry_1.purry)(_equals, arguments); | ||
} | ||
if (a && b && typeof a === "object" && typeof b === "object") { | ||
var arrA = isArray(a); | ||
var arrB = isArray(b); | ||
var i = void 0; | ||
var length_1; | ||
var key = void 0; | ||
if (arrA && arrB) { | ||
length_1 = a.length; | ||
if (length_1 !== b.length) { | ||
if (typeof a === "number" && typeof b === "number") { | ||
return a !== a && b !== b; | ||
} | ||
if (typeof a !== "object" || typeof b !== "object") { | ||
return false; | ||
} | ||
if (a === null || b === null) { | ||
return false; | ||
} | ||
var isArrayA = Array.isArray(a); | ||
var isArrayB = Array.isArray(b); | ||
if (isArrayA && isArrayB) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
for (var i = 0; i < a.length; i++) { | ||
if (!_equals(a[i], b[i])) { | ||
return false; | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
if (!equals(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
if (arrA !== arrB) { | ||
return true; | ||
} | ||
if (isArrayA !== isArrayB) { | ||
return false; | ||
} | ||
var isDateA = a instanceof Date; | ||
var isDateB = b instanceof Date; | ||
if (isDateA && isDateB) { | ||
return a.getTime() === b.getTime(); | ||
} | ||
if (isDateA !== isDateB) { | ||
return false; | ||
} | ||
var isRegExpA = a instanceof RegExp; | ||
var isRegExpB = b instanceof RegExp; | ||
if (isRegExpA && isRegExpB) { | ||
return a.toString() === b.toString(); | ||
} | ||
if (isRegExpA !== isRegExpB) { | ||
return false; | ||
} | ||
var keys = Object.keys(a); | ||
if (keys.length !== Object.keys(b).length) { | ||
return false; | ||
} | ||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { | ||
var key = keys_1[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(b, key)) { | ||
return false; | ||
} | ||
var dateA = a instanceof Date; | ||
var dateB = b instanceof Date; | ||
if (dateA !== dateB) { | ||
if (!_equals(a[key], b[key])) { | ||
return false; | ||
} | ||
if (dateA && dateB) { | ||
return a.getTime() === b.getTime(); | ||
} | ||
var regexpA = a instanceof RegExp; | ||
var regexpB = b instanceof RegExp; | ||
if (regexpA !== regexpB) { | ||
return false; | ||
} | ||
if (regexpA && regexpB) { | ||
return a.toString() === b.toString(); | ||
} | ||
var keys = keyList(a); | ||
length_1 = keys.length; | ||
if (length_1 !== keyList(b).length) { | ||
return false; | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) { | ||
return false; | ||
} | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
key = keys[i]; | ||
if (!equals(a[key], b[key])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return a !== a && b !== b; | ||
return true; | ||
} |
@@ -25,12 +25,13 @@ "use strict"; | ||
} | ||
return toPairs_1.toPairs.strict(evolver).reduce(function (result, _a) { | ||
var key = _a[0], value = _a[1]; | ||
if (key in result) { | ||
result[key] = | ||
var out = __assign({}, data); | ||
for (var _i = 0, _a = toPairs_1.toPairs.strict(evolver); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (key in out) { | ||
out[key] = | ||
typeof value === "function" | ||
? value(result[key]) | ||
: _evolve(result[key], value); | ||
? value(out[key]) | ||
: _evolve(out[key], value); | ||
} | ||
return result; | ||
}, __assign({}, data)); | ||
} | ||
return out; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filter = void 0; | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var purry_1 = require("./purry"); | ||
function filter() { | ||
@@ -19,14 +19,5 @@ return (0, purry_1.purry)(_filter(false), arguments, filter.lazy); | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (valid) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return (indexed ? fn(value, index, array) : fn(value)) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -33,0 +24,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.find = void 0; | ||
var purry_1 = require("./purry"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var _toSingle_1 = require("./_toSingle"); | ||
var purry_1 = require("./purry"); | ||
function find() { | ||
@@ -13,6 +13,5 @@ return (0, purry_1.purry)(_find(false), arguments, find.lazy); | ||
return function (array, fn) { | ||
if (indexed) { | ||
return array.find(fn); | ||
} | ||
return array.find(function (x) { return fn(x); }); | ||
return array.find(function (item, index, input) { | ||
return indexed ? fn(item, index, input) : fn(item); | ||
}); | ||
}; | ||
@@ -23,8 +22,5 @@ }; | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
return { | ||
done: valid, | ||
hasNext: valid, | ||
next: value, | ||
}; | ||
return (indexed ? fn(value, index, array) : fn(value)) | ||
? { done: true, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -31,0 +27,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findIndex = void 0; | ||
var purry_1 = require("./purry"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var _toSingle_1 = require("./_toSingle"); | ||
var purry_1 = require("./purry"); | ||
function findIndex() { | ||
@@ -13,6 +13,5 @@ return (0, purry_1.purry)(_findIndex(false), arguments, findIndex.lazy); | ||
return function (array, fn) { | ||
if (indexed) { | ||
return array.findIndex(fn); | ||
} | ||
return array.findIndex(function (x) { return fn(x); }); | ||
return array.findIndex(function (item, index, input) { | ||
return indexed ? fn(item, index, input) : fn(item); | ||
}); | ||
}; | ||
@@ -22,17 +21,9 @@ }; | ||
return function (fn) { | ||
var i = 0; | ||
var actualIndex = 0; | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (valid) { | ||
return { | ||
done: true, | ||
hasNext: true, | ||
next: i, | ||
}; | ||
if (indexed ? fn(value, index, array) : fn(value)) { | ||
return { done: true, hasNext: true, next: actualIndex }; | ||
} | ||
i++; | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
actualIndex += 1; | ||
return { done: false, hasNext: false }; | ||
}; | ||
@@ -39,0 +30,0 @@ }; |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
return undefined; | ||
return; | ||
}; | ||
@@ -19,0 +19,0 @@ }; |
@@ -10,12 +10,8 @@ "use strict"; | ||
function _first(_a) { | ||
var first = _a[0]; | ||
return first; | ||
var item = _a[0]; | ||
return item; | ||
} | ||
(function (first) { | ||
function lazy() { | ||
return function (value) { return ({ | ||
done: true, | ||
hasNext: true, | ||
next: value, | ||
}); }; | ||
return function (value) { return ({ done: true, hasNext: true, next: value }); }; | ||
} | ||
@@ -22,0 +18,0 @@ first.lazy = lazy; |
@@ -14,21 +14,10 @@ "use strict"; | ||
(function (flatMap) { | ||
function lazy(fn) { | ||
flatMap.lazy = function (fn) { | ||
return function (value) { | ||
var next = fn(value); | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
return Array.isArray(next) | ||
? { done: false, hasNext: true, hasMany: true, next: next } | ||
: { done: false, hasNext: true, next: next }; | ||
}; | ||
} | ||
flatMap.lazy = lazy; | ||
}; | ||
})(flatMap || (exports.flatMap = flatMap = {})); |
@@ -11,10 +11,12 @@ "use strict"; | ||
return function (array, fn) { | ||
return array.reduce(function (result, element, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var element = array[index]; | ||
var items = indexed ? fn(element, index, array) : fn(element); | ||
items.forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
result[key] = value; | ||
}); | ||
return result; | ||
}, {}); | ||
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { | ||
var _a = items_1[_i], key = _a[0], value = _a[1]; | ||
out[key] = value; | ||
} | ||
} | ||
return out; | ||
}; | ||
@@ -21,0 +23,0 @@ }; |
@@ -14,20 +14,9 @@ "use strict"; | ||
(function (flatten) { | ||
function lazy() { | ||
return function (next) { | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
flatten.lazy = function () { | ||
return function (item) { | ||
return Array.isArray(item) | ||
? { done: false, hasNext: true, hasMany: true, next: item } | ||
: { done: false, hasNext: true, next: item }; | ||
}; | ||
} | ||
flatten.lazy = lazy; | ||
}; | ||
})(flatten || (exports.flatten = flatten = {})); |
@@ -18,3 +18,4 @@ "use strict"; | ||
var ret = []; | ||
value.forEach(function (item) { | ||
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { | ||
var item = value_1[_i]; | ||
if (Array.isArray(item)) { | ||
@@ -26,25 +27,14 @@ ret.push.apply(ret, flattenDeep(item)); | ||
} | ||
}); | ||
} | ||
return ret; | ||
} | ||
(function (flattenDeep) { | ||
function lazy() { | ||
flattenDeep.lazy = function () { | ||
return function (value) { | ||
var next = _flattenDeepValue(value); | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
return Array.isArray(next) | ||
? { done: false, hasNext: true, hasMany: true, next: next } | ||
: { done: false, hasNext: true, next: next }; | ||
}; | ||
} | ||
flattenDeep.lazy = lazy; | ||
}; | ||
})(flattenDeep || (exports.flattenDeep = flattenDeep = {})); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.forEach = void 0; | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var purry_1 = require("./purry"); | ||
function forEach() { | ||
@@ -8,0 +8,0 @@ return (0, purry_1.purry)(_forEach(false), arguments, forEach.lazy); |
@@ -13,3 +13,3 @@ "use strict"; | ||
if (Object.prototype.hasOwnProperty.call(data, key)) { | ||
var val = data[key]; | ||
var _a = data, _b = key, val = _a[_b]; | ||
if (indexed) { | ||
@@ -16,0 +16,0 @@ fn(val, key, data); |
@@ -12,3 +12,4 @@ "use strict"; | ||
var ret = {}; | ||
array.forEach(function (item, index) { | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var key = indexed ? fn(item, index, array) : fn(item); | ||
@@ -24,3 +25,3 @@ if (key !== undefined) { | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -27,0 +28,0 @@ }; |
@@ -11,8 +11,10 @@ "use strict"; | ||
return function (array, fn) { | ||
return array.reduce(function (ret, item, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var value = indexed ? fn(item, index, array) : fn(item); | ||
var key = String(value); | ||
ret[key] = item; | ||
return ret; | ||
}, {}); | ||
out[key] = item; | ||
} | ||
return out; | ||
}; | ||
@@ -23,9 +25,11 @@ }; | ||
} | ||
var _indexByStrict = function (array, fn) { | ||
return array.reduce(function (ret, item) { | ||
function _indexByStrict(array, fn) { | ||
var out = {}; | ||
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { | ||
var item = array_1[_i]; | ||
var key = fn(item); | ||
ret[key] = item; | ||
return ret; | ||
}, {}); | ||
}; | ||
out[key] = item; | ||
} | ||
return out; | ||
} | ||
(function (indexBy) { | ||
@@ -32,0 +36,0 @@ function indexed() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.intersection = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function intersection() { | ||
@@ -16,15 +16,7 @@ return (0, purry_1.purry)(_intersection, arguments, intersection.lazy); | ||
function lazy(other) { | ||
var set = new Set(other); | ||
return function (value) { | ||
var set = new Set(other); | ||
if (set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return set.has(value) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -31,0 +23,0 @@ } |
@@ -15,18 +15,9 @@ "use strict"; | ||
(function (intersectionWith) { | ||
function lazy(other, comparator) { | ||
intersectionWith.lazy = function (other, comparator) { | ||
return function (value) { | ||
if (other.some(function (otherValue) { return comparator(value, otherValue); })) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return other.some(function (otherValue) { return comparator(value, otherValue); }) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
intersectionWith.lazy = lazy; | ||
}; | ||
})(intersectionWith || (exports.intersectionWith = intersectionWith = {})); |
@@ -12,5 +12,7 @@ "use strict"; | ||
for (var key in object) { | ||
result[object[key]] = key; | ||
if (Object.prototype.hasOwnProperty.call(object, key)) { | ||
result[object[key]] = key; | ||
} | ||
} | ||
return result; | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
function isDefined(data) { | ||
return typeof data !== "undefined" && data !== null; | ||
return data !== undefined && data !== null; | ||
} | ||
@@ -8,0 +8,0 @@ exports.isDefined = isDefined; |
@@ -5,4 +5,4 @@ "use strict"; | ||
function isNil(data) { | ||
return data == null; | ||
return data === null || data === undefined; | ||
} | ||
exports.isNil = isNil; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.map = void 0; | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var purry_1 = require("./purry"); | ||
function map() { | ||
@@ -8,0 +8,0 @@ return (0, purry_1.purry)(_map(false), arguments, map.lazy); |
@@ -11,7 +11,9 @@ "use strict"; | ||
return function (array, fn) { | ||
return array.reduce(function (result, element, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var element = array[index]; | ||
var _a = indexed ? fn(element, index, array) : fn(element), key = _a[0], value = _a[1]; | ||
result[key] = value; | ||
return result; | ||
}, {}); | ||
out[key] = value; | ||
} | ||
return out; | ||
}; | ||
@@ -18,0 +20,0 @@ }; |
@@ -14,5 +14,6 @@ "use strict"; | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
out[key] = fn(value, key); | ||
var mappedValue = fn(value, key); | ||
out[key] = mappedValue; | ||
} | ||
return out; | ||
} |
@@ -7,6 +7,7 @@ "use strict"; | ||
return function (array, fn) { | ||
var ret = undefined; | ||
var retMax = undefined; | ||
array.forEach(function (item, i) { | ||
var max = indexed ? fn(item, i, array) : fn(item); | ||
var ret; | ||
var retMax; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var max = indexed ? fn(item, index, array) : fn(item); | ||
if (retMax === undefined || max > retMax) { | ||
@@ -16,3 +17,3 @@ ret = item; | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -19,0 +20,0 @@ }; |
@@ -11,5 +11,6 @@ "use strict"; | ||
var sum = 0; | ||
array.forEach(function (item, i) { | ||
sum += indexed ? fn(item, i, array) : fn(item); | ||
}); | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
sum += indexed ? fn(item, index, array) : fn(item); | ||
} | ||
return sum / array.length; | ||
@@ -16,0 +17,0 @@ }; |
@@ -16,4 +16,9 @@ "use strict"; | ||
function mergeAll(items) { | ||
return items.reduce(function (acc, x) { return (__assign(__assign({}, acc), x)); }, {}); | ||
var out = {}; | ||
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { | ||
var item = items_1[_i]; | ||
out = __assign(__assign({}, out), item); | ||
} | ||
return out; | ||
} | ||
exports.mergeAll = mergeAll; |
@@ -26,7 +26,7 @@ "use strict"; | ||
} | ||
var destinationValue = destination[key]; | ||
var _a = destination, _b = key, destinationValue = _a[_b]; | ||
if (!isRecord(destinationValue)) { | ||
continue; | ||
} | ||
var sourceValue = source[key]; | ||
var _c = source, _d = key, sourceValue = _c[_d]; | ||
if (!isRecord(sourceValue)) { | ||
@@ -33,0 +33,0 @@ continue; |
@@ -7,6 +7,7 @@ "use strict"; | ||
return function (array, fn) { | ||
var ret = undefined; | ||
var retMin = undefined; | ||
array.forEach(function (item, i) { | ||
var min = indexed ? fn(item, i, array) : fn(item); | ||
var ret; | ||
var retMin; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var min = indexed ? fn(item, index, array) : fn(item); | ||
if (retMin === undefined || min < retMin) { | ||
@@ -16,3 +17,3 @@ ret = item; | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -19,0 +20,0 @@ }; |
@@ -14,8 +14,10 @@ "use strict"; | ||
} | ||
return keys_1.keys.strict(object).reduce(function (acc, key) { | ||
var out = {}; | ||
for (var _i = 0, _a = keys_1.keys.strict(object); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (!fn(object[key], key)) { | ||
acc[key] = object[key]; | ||
out[key] = object[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -10,6 +10,3 @@ "use strict"; | ||
function _only(array) { | ||
if (array.length === 1) { | ||
return array[0]; | ||
} | ||
return undefined; | ||
return array.length === 1 ? array[0] : undefined; | ||
} |
@@ -12,6 +12,7 @@ "use strict"; | ||
var ret = [[], []]; | ||
array.forEach(function (item, index) { | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var matches = indexed ? fn(item, index, array) : fn(item); | ||
ret[matches ? 0 : 1].push(item); | ||
}); | ||
} | ||
return ret; | ||
@@ -18,0 +19,0 @@ }; |
@@ -13,3 +13,3 @@ "use strict"; | ||
var prop = path_1[_i]; | ||
if (current == null) { | ||
if (current === null || current === undefined) { | ||
break; | ||
@@ -16,0 +16,0 @@ } |
@@ -10,8 +10,10 @@ "use strict"; | ||
function _pick(object, names) { | ||
return names.reduce(function (acc, name) { | ||
if (name in object) { | ||
acc[name] = object[name]; | ||
var out = {}; | ||
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { | ||
var name_1 = names_1[_i]; | ||
if (name_1 in object) { | ||
out[name_1] = object[name_1]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -10,12 +10,14 @@ "use strict"; | ||
exports.pickBy = pickBy; | ||
function _pickBy(object, fn) { | ||
if (object == null) { | ||
function _pickBy(data, fn) { | ||
if (data === null || data === undefined) { | ||
return {}; | ||
} | ||
return keys_1.keys.strict(object).reduce(function (acc, key) { | ||
if (fn(object[key], key)) { | ||
acc[key] = object[key]; | ||
var out = {}; | ||
for (var _i = 0, _a = keys_1.keys.strict(data); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (fn(data[key], key)) { | ||
out[key] = data[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -12,3 +12,3 @@ "use strict"; | ||
var lazyOperations = operations.map(function (op) { | ||
return "lazy" in op ? toPipedLazy(op) : undefined; | ||
return "lazy" in op ? prepareLazyOperation(op) : undefined; | ||
}); | ||
@@ -21,8 +21,8 @@ var operationIndex = 0; | ||
output = operation(output); | ||
operationIndex++; | ||
operationIndex += 1; | ||
continue; | ||
} | ||
var lazySequence = []; | ||
for (var j = operationIndex; j < operations.length; j++) { | ||
var lazyOp = lazyOperations[j]; | ||
for (var index = operationIndex; index < operations.length; index++) { | ||
var lazyOp = lazyOperations[index]; | ||
if (lazyOp === undefined) { | ||
@@ -49,8 +49,3 @@ break; | ||
var isSingle = lazySequence[lazySequence.length - 1].isSingle; | ||
if (isSingle) { | ||
output = accumulator[0]; | ||
} | ||
else { | ||
output = accumulator; | ||
} | ||
output = isSingle ? accumulator[0] : accumulator; | ||
operationIndex += lazySequence.length; | ||
@@ -62,2 +57,3 @@ } | ||
function _processItem(item, accumulator, lazySequence) { | ||
var _a; | ||
if (lazySequence.length === 0) { | ||
@@ -67,16 +63,18 @@ accumulator.push(item); | ||
} | ||
var currentItem = item; | ||
var lazyResult = { done: false, hasNext: false }; | ||
var isDone = false; | ||
for (var i = 0; i < lazySequence.length; i++) { | ||
var lazyFn = lazySequence[i]; | ||
for (var operationsIndex = 0; operationsIndex < lazySequence.length; operationsIndex++) { | ||
var lazyFn = lazySequence[operationsIndex]; | ||
var isIndexed = lazyFn.isIndexed, index = lazyFn.index, items = lazyFn.items; | ||
items.push(item); | ||
lazyResult = isIndexed ? lazyFn(item, index, items) : lazyFn(item); | ||
lazyFn.index++; | ||
items.push(currentItem); | ||
lazyResult = isIndexed | ||
? lazyFn(currentItem, index, items) | ||
: lazyFn(currentItem); | ||
lazyFn.index += 1; | ||
if (lazyResult.hasNext) { | ||
if (lazyResult.hasMany) { | ||
var nextValues = lazyResult.next; | ||
for (var _i = 0, nextValues_1 = nextValues; _i < nextValues_1.length; _i++) { | ||
var subItem = nextValues_1[_i]; | ||
var subResult = _processItem(subItem, accumulator, lazySequence.slice(i + 1)); | ||
if ((_a = lazyResult.hasMany) !== null && _a !== void 0 ? _a : false) { | ||
for (var _i = 0, _b = lazyResult.next; _i < _b.length; _i++) { | ||
var subItem = _b[_i]; | ||
var subResult = _processItem(subItem, accumulator, lazySequence.slice(operationsIndex + 1)); | ||
if (subResult) { | ||
@@ -88,3 +86,3 @@ return true; | ||
} | ||
item = lazyResult.next; | ||
currentItem = lazyResult.next; | ||
} | ||
@@ -99,3 +97,3 @@ if (!lazyResult.hasNext) { | ||
if (lazyResult.hasNext) { | ||
accumulator.push(item); | ||
accumulator.push(currentItem); | ||
} | ||
@@ -107,3 +105,3 @@ if (isDone) { | ||
} | ||
function toPipedLazy(op) { | ||
function prepareLazyOperation(op) { | ||
var lazy = op.lazy, lazyArgs = op.lazyArgs; | ||
@@ -110,0 +108,0 @@ var fn = lazy.apply(void 0, (lazyArgs !== null && lazyArgs !== void 0 ? lazyArgs : [])); |
@@ -14,2 +14,4 @@ "use strict"; | ||
} | ||
var randomChar = function () { return ALPHABET[Math.floor(Math.random() * ALPHABET.length)]; }; | ||
var randomChar = function () { | ||
return ALPHABET[Math.floor(Math.random() * ALPHABET.length)]; | ||
}; |
@@ -14,3 +14,3 @@ "use strict"; | ||
if (compareFn(targetItem, item) > 0) { | ||
rank++; | ||
rank += 1; | ||
} | ||
@@ -17,0 +17,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.reject = void 0; | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var purry_1 = require("./purry"); | ||
function reject() { | ||
@@ -18,15 +18,6 @@ return (0, purry_1.purry)(_reject(false), arguments, reject.lazy); | ||
return function (fn) { | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (!valid) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return function (item, index, data) { | ||
return (indexed ? fn(item, index, data) : fn(item)) | ||
? { done: false, hasNext: false } | ||
: { done: false, hasNext: true, next: item }; | ||
}; | ||
@@ -33,0 +24,0 @@ }; |
@@ -21,3 +21,3 @@ "use strict"; | ||
if (sampleSize >= data.length) { | ||
return data; | ||
return data.slice(); | ||
} | ||
@@ -24,0 +24,0 @@ if (sampleSize === 0) { |
@@ -11,3 +11,3 @@ "use strict"; | ||
var result = items.slice(); | ||
for (var index = 0; index < items.length; index += 1) { | ||
for (var index = 0; index < items.length; index++) { | ||
var rand = index + Math.floor(Math.random() * (items.length - index)); | ||
@@ -14,0 +14,0 @@ var value = result[rand]; |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,3 +10,3 @@ exports.sort = void 0; | ||
function _sort(items, cmp) { | ||
var ret = __spreadArray([], items, true); | ||
var ret = items.slice(); | ||
ret.sort(cmp); | ||
@@ -22,0 +13,0 @@ return ret; |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,3 +10,3 @@ exports.sortBy = void 0; | ||
var _sortBy = function (data, compareFn) { | ||
return __spreadArray([], data, true).sort(compareFn); | ||
return data.slice().sort(compareFn); | ||
}; | ||
@@ -22,0 +13,0 @@ (function (sortBy) { |
@@ -19,5 +19,5 @@ "use strict"; | ||
function _splice(items, start, deleteCount, replacement) { | ||
var result = __spreadArray([], items, true); | ||
var result = items.slice(); | ||
result.splice.apply(result, __spreadArray([start, deleteCount], replacement, false)); | ||
return result; | ||
} |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,5 +10,5 @@ exports.splitAt = void 0; | ||
function _splitAt(array, index) { | ||
var copy = __spreadArray([], array, true); | ||
var copy = array.slice(); | ||
var tail = copy.splice(index); | ||
return [copy, tail]; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
return [array, []]; | ||
return [array.slice(), []]; | ||
} |
@@ -22,4 +22,4 @@ "use strict"; | ||
} | ||
var match = (_a = /^\[(.+?)\](.*)$/.exec(path)) !== null && _a !== void 0 ? _a : /^\.?([^.[\]]+)(.*)$/.exec(path); | ||
if (match) { | ||
var match = (_a = /^\[(.+?)\](.*)$/u.exec(path)) !== null && _a !== void 0 ? _a : /^\.?([^.[\]]+)(.*)$/u.exec(path); | ||
if (match !== null) { | ||
var key = match[1], rest = match[2]; | ||
@@ -26,0 +26,0 @@ return __spreadArray([key], _stringToPath(rest), true); |
@@ -8,6 +8,7 @@ "use strict"; | ||
var sum = 0; | ||
array.forEach(function (item, i) { | ||
var summand = indexed ? fn(item, i, array) : fn(item); | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var summand = indexed ? fn(item, index, array) : fn(item); | ||
sum += summand; | ||
}); | ||
} | ||
return sum; | ||
@@ -14,0 +15,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.take = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function take() { | ||
@@ -15,22 +15,9 @@ return (0, purry_1.purry)(_take, arguments, take.lazy); | ||
function lazy(n) { | ||
if (n <= 0) { | ||
return function () { return ({ done: true, hasNext: false }); }; | ||
} | ||
var remaining = n; | ||
return function (value) { | ||
if (n === 0) { | ||
return { | ||
done: true, | ||
hasNext: false, | ||
}; | ||
} | ||
n--; | ||
if (n === 0) { | ||
return { | ||
done: true, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
remaining -= 1; | ||
return { done: remaining <= 0, hasNext: true, next: value }; | ||
}; | ||
@@ -37,0 +24,0 @@ } |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -24,3 +15,3 @@ exports.takeFirstBy = void 0; | ||
if (n >= data.length) { | ||
return __spreadArray([], data, true); | ||
return data.slice(); | ||
} | ||
@@ -27,0 +18,0 @@ var heap = data.slice(0, n); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniq = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function uniq() { | ||
@@ -18,13 +18,6 @@ return (0, purry_1.purry)(_uniq, arguments, uniq.lazy); | ||
if (set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return { done: false, hasNext: false }; | ||
} | ||
set.add(value); | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -31,0 +24,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniqBy = void 0; | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
function uniqBy() { | ||
@@ -18,14 +18,7 @@ return (0, purry_1.purry)(_uniqBy, arguments, lazyUniqBy); | ||
if (set.has(appliedItem)) { | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return { done: false, hasNext: false }; | ||
} | ||
set.add(appliedItem); | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniqWith = void 0; | ||
var purry_1 = require("./purry"); | ||
var _reduceLazy_1 = require("./_reduceLazy"); | ||
var _toLazyIndexed_1 = require("./_toLazyIndexed"); | ||
var purry_1 = require("./purry"); | ||
function uniqWith() { | ||
@@ -15,20 +15,12 @@ return (0, purry_1.purry)(_uniqWith, arguments, uniqWith.lazy); | ||
} | ||
function _lazy(isEquals) { | ||
var _lazy = function (isEquals) { | ||
return function (value, index, array) { | ||
if (array && | ||
array.findIndex(function (otherValue) { return isEquals(value, otherValue); }) === index) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return array !== undefined && | ||
array.findIndex(function (otherValue) { return isEquals(value, otherValue); }) === index | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
}; | ||
(function (uniqWith) { | ||
uniqWith.lazy = (0, _toLazyIndexed_1._toLazyIndexed)(_lazy); | ||
})(uniqWith || (exports.uniqWith = uniqWith = {})); |
@@ -50,3 +50,3 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
var direction = typeof primaryRule === "function" ? "asc" : primaryRule[1]; | ||
var comparator = COMPARATORS[direction]; | ||
var _a = COMPARATORS, _b = direction, comparator = _a[_b]; | ||
var nextComparer = secondaryRule === undefined | ||
@@ -53,0 +53,0 @@ ? undefined |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { swapInPlace } from "./_swapInPlace"; | ||
@@ -15,3 +6,3 @@ export var quickSelect = function (data, index, compareFn) { | ||
undefined | ||
: quickSelectImplementation(__spreadArray([], data, true), 0, data.length - 1, index, compareFn); | ||
: quickSelectImplementation(data.slice(), 0, data.length - 1, index, compareFn); | ||
}; | ||
@@ -34,3 +25,3 @@ function quickSelectImplementation(data, left, right, index, compareFn) { | ||
swapInPlace(data, i, j); | ||
i++; | ||
i += 1; | ||
} | ||
@@ -37,0 +28,0 @@ } |
@@ -1,14 +0,18 @@ | ||
export function _reduceLazy(array, lazy, indexed) { | ||
var newArray = []; | ||
export function _reduceLazy(array, lazy, isIndexed) { | ||
if (isIndexed === void 0) { isIndexed = false; } | ||
var out = []; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var result = indexed ? lazy(item, index, array) : lazy(item); | ||
var result = isIndexed ? lazy(item, index, array) : lazy(item); | ||
if (result.hasMany === true) { | ||
newArray.push.apply(newArray, result.next); | ||
out.push.apply(out, result.next); | ||
} | ||
else if (result.hasNext) { | ||
newArray.push(result.next); | ||
out.push(result.next); | ||
} | ||
if (result.done) { | ||
break; | ||
} | ||
} | ||
return newArray; | ||
return out; | ||
} |
@@ -1,3 +0,1 @@ | ||
export var _toSingle = function (fn) { | ||
return Object.assign(fn, { single: true }); | ||
}; | ||
export var _toSingle = function (fn) { return Object.assign(fn, { single: true }); }; |
@@ -9,3 +9,3 @@ import { purry } from "./purry"; | ||
}); | ||
for (var index = 0; index < ret.length; index += 1) { | ||
for (var index = 0; index < ret.length; index++) { | ||
ret[index] = array.slice(index * size, (index + 1) * size); | ||
@@ -12,0 +12,0 @@ } |
@@ -5,14 +5,9 @@ import { purry } from "./purry"; | ||
} | ||
function _clamp(value, limits) { | ||
if (limits.min != null) { | ||
if (limits.min > value) { | ||
return limits.min; | ||
} | ||
} | ||
if (limits.max != null) { | ||
if (limits.max < value) { | ||
return limits.max; | ||
} | ||
} | ||
return value; | ||
function _clamp(value, _a) { | ||
var min = _a.min, max = _a.max; | ||
return min !== undefined && value < min | ||
? min | ||
: max !== undefined && value > max | ||
? max | ||
: value; | ||
} |
import { purry } from "./purry"; | ||
var _countBy = function (indexed) { | ||
return function (array, fn) { | ||
return array.reduce(function (ret, item, index) { | ||
var out = 0; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var value = indexed ? fn(item, index, array) : fn(item); | ||
return ret + (value ? 1 : 0); | ||
}, 0); | ||
out += value ? 1 : 0; | ||
} | ||
return out; | ||
}; | ||
@@ -9,0 +12,0 @@ }; |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function difference() { | ||
@@ -14,13 +14,5 @@ return purry(_difference, arguments, difference.lazy); | ||
return function (value) { | ||
if (!set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return set.has(value) | ||
? { done: false, hasNext: false } | ||
: { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -27,0 +19,0 @@ } |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function differenceWith() { | ||
@@ -11,18 +11,9 @@ return purry(_differenceWith, arguments, differenceWith.lazy); | ||
(function (differenceWith) { | ||
function lazy(other, isEquals) { | ||
differenceWith.lazy = function (other, isEquals) { | ||
return function (value) { | ||
if (other.every(function (otherValue) { return !isEquals(value, otherValue); })) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return other.every(function (otherValue) { return !isEquals(value, otherValue); }) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
differenceWith.lazy = lazy; | ||
}; | ||
})(differenceWith || (differenceWith = {})); |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function drop() { | ||
@@ -14,13 +14,6 @@ return purry(_drop, arguments, drop.lazy); | ||
if (left > 0) { | ||
left--; | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
left -= 1; | ||
return { done: false, hasNext: false }; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -27,0 +20,0 @@ } |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { heapify, heapMaybeInsert } from "./_heap"; | ||
@@ -20,3 +11,3 @@ import { purryOrderRulesWithArgument } from "./_purryOrderRules"; | ||
if (n <= 0) { | ||
return __spreadArray([], data, true); | ||
return data.slice(); | ||
} | ||
@@ -23,0 +14,0 @@ var heap = data.slice(0, n); |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { purry } from "./purry"; | ||
@@ -15,3 +6,3 @@ export function dropLast() { | ||
function _dropLast(array, n) { | ||
var copy = __spreadArray([], array, true); | ||
var copy = array.slice(); | ||
if (n > 0) { | ||
@@ -18,0 +9,0 @@ copy.splice(-n); |
import { purry } from "./purry"; | ||
var isArray = Array.isArray; | ||
var keyList = Object.keys; | ||
export function equals() { | ||
@@ -11,58 +9,57 @@ return purry(_equals, arguments); | ||
} | ||
if (a && b && typeof a === "object" && typeof b === "object") { | ||
var arrA = isArray(a); | ||
var arrB = isArray(b); | ||
var i = void 0; | ||
var length_1; | ||
var key = void 0; | ||
if (arrA && arrB) { | ||
length_1 = a.length; | ||
if (length_1 !== b.length) { | ||
if (typeof a === "number" && typeof b === "number") { | ||
return a !== a && b !== b; | ||
} | ||
if (typeof a !== "object" || typeof b !== "object") { | ||
return false; | ||
} | ||
if (a === null || b === null) { | ||
return false; | ||
} | ||
var isArrayA = Array.isArray(a); | ||
var isArrayB = Array.isArray(b); | ||
if (isArrayA && isArrayB) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
for (var i = 0; i < a.length; i++) { | ||
if (!_equals(a[i], b[i])) { | ||
return false; | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
if (!equals(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
if (arrA !== arrB) { | ||
return true; | ||
} | ||
if (isArrayA !== isArrayB) { | ||
return false; | ||
} | ||
var isDateA = a instanceof Date; | ||
var isDateB = b instanceof Date; | ||
if (isDateA && isDateB) { | ||
return a.getTime() === b.getTime(); | ||
} | ||
if (isDateA !== isDateB) { | ||
return false; | ||
} | ||
var isRegExpA = a instanceof RegExp; | ||
var isRegExpB = b instanceof RegExp; | ||
if (isRegExpA && isRegExpB) { | ||
return a.toString() === b.toString(); | ||
} | ||
if (isRegExpA !== isRegExpB) { | ||
return false; | ||
} | ||
var keys = Object.keys(a); | ||
if (keys.length !== Object.keys(b).length) { | ||
return false; | ||
} | ||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { | ||
var key = keys_1[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(b, key)) { | ||
return false; | ||
} | ||
var dateA = a instanceof Date; | ||
var dateB = b instanceof Date; | ||
if (dateA !== dateB) { | ||
if (!_equals(a[key], b[key])) { | ||
return false; | ||
} | ||
if (dateA && dateB) { | ||
return a.getTime() === b.getTime(); | ||
} | ||
var regexpA = a instanceof RegExp; | ||
var regexpB = b instanceof RegExp; | ||
if (regexpA !== regexpB) { | ||
return false; | ||
} | ||
if (regexpA && regexpB) { | ||
return a.toString() === b.toString(); | ||
} | ||
var keys = keyList(a); | ||
length_1 = keys.length; | ||
if (length_1 !== keyList(b).length) { | ||
return false; | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) { | ||
return false; | ||
} | ||
} | ||
for (i = length_1; i-- !== 0;) { | ||
key = keys[i]; | ||
if (!equals(a[key], b[key])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return a !== a && b !== b; | ||
return true; | ||
} |
@@ -21,12 +21,13 @@ var __assign = (this && this.__assign) || function () { | ||
} | ||
return toPairs.strict(evolver).reduce(function (result, _a) { | ||
var key = _a[0], value = _a[1]; | ||
if (key in result) { | ||
result[key] = | ||
var out = __assign({}, data); | ||
for (var _i = 0, _a = toPairs.strict(evolver); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
if (key in out) { | ||
out[key] = | ||
typeof value === "function" | ||
? value(result[key]) | ||
: _evolve(result[key], value); | ||
? value(out[key]) | ||
: _evolve(out[key], value); | ||
} | ||
return result; | ||
}, __assign({}, data)); | ||
} | ||
return out; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { purry } from "./purry"; | ||
export function filter() { | ||
@@ -15,14 +15,5 @@ return purry(_filter(false), arguments, filter.lazy); | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (valid) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return (indexed ? fn(value, index, array) : fn(value)) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -29,0 +20,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { _toSingle } from "./_toSingle"; | ||
import { purry } from "./purry"; | ||
export function find() { | ||
@@ -9,6 +9,5 @@ return purry(_find(false), arguments, find.lazy); | ||
return function (array, fn) { | ||
if (indexed) { | ||
return array.find(fn); | ||
} | ||
return array.find(function (x) { return fn(x); }); | ||
return array.find(function (item, index, input) { | ||
return indexed ? fn(item, index, input) : fn(item); | ||
}); | ||
}; | ||
@@ -19,8 +18,5 @@ }; | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
return { | ||
done: valid, | ||
hasNext: valid, | ||
next: value, | ||
}; | ||
return (indexed ? fn(value, index, array) : fn(value)) | ||
? { done: true, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -27,0 +23,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { _toSingle } from "./_toSingle"; | ||
import { purry } from "./purry"; | ||
export function findIndex() { | ||
@@ -9,6 +9,5 @@ return purry(_findIndex(false), arguments, findIndex.lazy); | ||
return function (array, fn) { | ||
if (indexed) { | ||
return array.findIndex(fn); | ||
} | ||
return array.findIndex(function (x) { return fn(x); }); | ||
return array.findIndex(function (item, index, input) { | ||
return indexed ? fn(item, index, input) : fn(item); | ||
}); | ||
}; | ||
@@ -18,17 +17,9 @@ }; | ||
return function (fn) { | ||
var i = 0; | ||
var actualIndex = 0; | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (valid) { | ||
return { | ||
done: true, | ||
hasNext: true, | ||
next: i, | ||
}; | ||
if (indexed ? fn(value, index, array) : fn(value)) { | ||
return { done: true, hasNext: true, next: actualIndex }; | ||
} | ||
i++; | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
actualIndex += 1; | ||
return { done: false, hasNext: false }; | ||
}; | ||
@@ -35,0 +26,0 @@ }; |
@@ -12,3 +12,3 @@ import { purry } from "./purry"; | ||
} | ||
return undefined; | ||
return; | ||
}; | ||
@@ -15,0 +15,0 @@ }; |
@@ -6,12 +6,8 @@ import { purry } from "./purry"; | ||
function _first(_a) { | ||
var first = _a[0]; | ||
return first; | ||
var item = _a[0]; | ||
return item; | ||
} | ||
(function (first) { | ||
function lazy() { | ||
return function (value) { return ({ | ||
done: true, | ||
hasNext: true, | ||
next: value, | ||
}); }; | ||
return function (value) { return ({ done: true, hasNext: true, next: value }); }; | ||
} | ||
@@ -18,0 +14,0 @@ first.lazy = lazy; |
@@ -10,21 +10,10 @@ import { flatten } from "./flatten"; | ||
(function (flatMap) { | ||
function lazy(fn) { | ||
flatMap.lazy = function (fn) { | ||
return function (value) { | ||
var next = fn(value); | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
return Array.isArray(next) | ||
? { done: false, hasNext: true, hasMany: true, next: next } | ||
: { done: false, hasNext: true, next: next }; | ||
}; | ||
} | ||
flatMap.lazy = lazy; | ||
}; | ||
})(flatMap || (flatMap = {})); |
@@ -7,10 +7,12 @@ import { purry } from "./purry"; | ||
return function (array, fn) { | ||
return array.reduce(function (result, element, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var element = array[index]; | ||
var items = indexed ? fn(element, index, array) : fn(element); | ||
items.forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
result[key] = value; | ||
}); | ||
return result; | ||
}, {}); | ||
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { | ||
var _a = items_1[_i], key = _a[0], value = _a[1]; | ||
out[key] = value; | ||
} | ||
} | ||
return out; | ||
}; | ||
@@ -17,0 +19,0 @@ }; |
@@ -10,20 +10,9 @@ import { _reduceLazy } from "./_reduceLazy"; | ||
(function (flatten) { | ||
function lazy() { | ||
return function (next) { | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
flatten.lazy = function () { | ||
return function (item) { | ||
return Array.isArray(item) | ||
? { done: false, hasNext: true, hasMany: true, next: item } | ||
: { done: false, hasNext: true, next: item }; | ||
}; | ||
} | ||
flatten.lazy = lazy; | ||
}; | ||
})(flatten || (flatten = {})); |
@@ -14,3 +14,4 @@ import { _reduceLazy } from "./_reduceLazy"; | ||
var ret = []; | ||
value.forEach(function (item) { | ||
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { | ||
var item = value_1[_i]; | ||
if (Array.isArray(item)) { | ||
@@ -22,25 +23,14 @@ ret.push.apply(ret, flattenDeep(item)); | ||
} | ||
}); | ||
} | ||
return ret; | ||
} | ||
(function (flattenDeep) { | ||
function lazy() { | ||
flattenDeep.lazy = function () { | ||
return function (value) { | ||
var next = _flattenDeepValue(value); | ||
if (Array.isArray(next)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
hasMany: true, | ||
next: next, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: next, | ||
}; | ||
return Array.isArray(next) | ||
? { done: false, hasNext: true, hasMany: true, next: next } | ||
: { done: false, hasNext: true, next: next }; | ||
}; | ||
} | ||
flattenDeep.lazy = lazy; | ||
}; | ||
})(flattenDeep || (flattenDeep = {})); |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { purry } from "./purry"; | ||
export function forEach() { | ||
@@ -5,0 +5,0 @@ return purry(_forEach(false), arguments, forEach.lazy); |
@@ -9,3 +9,3 @@ import { purry } from "./purry"; | ||
if (Object.prototype.hasOwnProperty.call(data, key)) { | ||
var val = data[key]; | ||
var _a = data, _b = key, val = _a[_b]; | ||
if (indexed) { | ||
@@ -12,0 +12,0 @@ fn(val, key, data); |
@@ -8,3 +8,4 @@ import { purry } from "./purry"; | ||
var ret = {}; | ||
array.forEach(function (item, index) { | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var key = indexed ? fn(item, index, array) : fn(item); | ||
@@ -20,3 +21,3 @@ if (key !== undefined) { | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -23,0 +24,0 @@ }; |
@@ -7,8 +7,10 @@ import { purry } from "./purry"; | ||
return function (array, fn) { | ||
return array.reduce(function (ret, item, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var value = indexed ? fn(item, index, array) : fn(item); | ||
var key = String(value); | ||
ret[key] = item; | ||
return ret; | ||
}, {}); | ||
out[key] = item; | ||
} | ||
return out; | ||
}; | ||
@@ -19,9 +21,11 @@ }; | ||
} | ||
var _indexByStrict = function (array, fn) { | ||
return array.reduce(function (ret, item) { | ||
function _indexByStrict(array, fn) { | ||
var out = {}; | ||
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { | ||
var item = array_1[_i]; | ||
var key = fn(item); | ||
ret[key] = item; | ||
return ret; | ||
}, {}); | ||
}; | ||
out[key] = item; | ||
} | ||
return out; | ||
} | ||
(function (indexBy) { | ||
@@ -28,0 +32,0 @@ function indexed() { |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function intersection() { | ||
@@ -12,15 +12,7 @@ return purry(_intersection, arguments, intersection.lazy); | ||
function lazy(other) { | ||
var set = new Set(other); | ||
return function (value) { | ||
var set = new Set(other); | ||
if (set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return set.has(value) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
@@ -27,0 +19,0 @@ } |
@@ -11,18 +11,9 @@ import { _reduceLazy } from "./_reduceLazy"; | ||
(function (intersectionWith) { | ||
function lazy(other, comparator) { | ||
intersectionWith.lazy = function (other, comparator) { | ||
return function (value) { | ||
if (other.some(function (otherValue) { return comparator(value, otherValue); })) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return other.some(function (otherValue) { return comparator(value, otherValue); }) | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
intersectionWith.lazy = lazy; | ||
}; | ||
})(intersectionWith || (intersectionWith = {})); |
@@ -8,5 +8,7 @@ import { purry } from "./purry"; | ||
for (var key in object) { | ||
result[object[key]] = key; | ||
if (Object.prototype.hasOwnProperty.call(object, key)) { | ||
result[object[key]] = key; | ||
} | ||
} | ||
return result; | ||
} |
export function isDefined(data) { | ||
return typeof data !== "undefined" && data !== null; | ||
return data !== undefined && data !== null; | ||
} | ||
@@ -4,0 +4,0 @@ (function (isDefined) { |
export function isNil(data) { | ||
return data == null; | ||
return data === null || data === undefined; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { purry } from "./purry"; | ||
export function map() { | ||
@@ -5,0 +5,0 @@ return purry(_map(false), arguments, map.lazy); |
@@ -7,7 +7,9 @@ import { purry } from "./purry"; | ||
return function (array, fn) { | ||
return array.reduce(function (result, element, index) { | ||
var out = {}; | ||
for (var index = 0; index < array.length; index++) { | ||
var element = array[index]; | ||
var _a = indexed ? fn(element, index, array) : fn(element), key = _a[0], value = _a[1]; | ||
result[key] = value; | ||
return result; | ||
}, {}); | ||
out[key] = value; | ||
} | ||
return out; | ||
}; | ||
@@ -14,0 +16,0 @@ }; |
@@ -10,5 +10,6 @@ import { purry } from "./purry"; | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
out[key] = fn(value, key); | ||
var mappedValue = fn(value, key); | ||
out[key] = mappedValue; | ||
} | ||
return out; | ||
} |
import { purry } from "./purry"; | ||
var _maxBy = function (indexed) { | ||
return function (array, fn) { | ||
var ret = undefined; | ||
var retMax = undefined; | ||
array.forEach(function (item, i) { | ||
var max = indexed ? fn(item, i, array) : fn(item); | ||
var ret; | ||
var retMax; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var max = indexed ? fn(item, index, array) : fn(item); | ||
if (retMax === undefined || max > retMax) { | ||
@@ -12,3 +13,3 @@ ret = item; | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -15,0 +16,0 @@ }; |
@@ -8,5 +8,6 @@ import { purry } from "./purry"; | ||
var sum = 0; | ||
array.forEach(function (item, i) { | ||
sum += indexed ? fn(item, i, array) : fn(item); | ||
}); | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
sum += indexed ? fn(item, index, array) : fn(item); | ||
} | ||
return sum / array.length; | ||
@@ -13,0 +14,0 @@ }; |
@@ -13,3 +13,8 @@ var __assign = (this && this.__assign) || function () { | ||
export function mergeAll(items) { | ||
return items.reduce(function (acc, x) { return (__assign(__assign({}, acc), x)); }, {}); | ||
var out = {}; | ||
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { | ||
var item = items_1[_i]; | ||
out = __assign(__assign({}, out), item); | ||
} | ||
return out; | ||
} |
@@ -22,7 +22,7 @@ var __assign = (this && this.__assign) || function () { | ||
} | ||
var destinationValue = destination[key]; | ||
var _a = destination, _b = key, destinationValue = _a[_b]; | ||
if (!isRecord(destinationValue)) { | ||
continue; | ||
} | ||
var sourceValue = source[key]; | ||
var _c = source, _d = key, sourceValue = _c[_d]; | ||
if (!isRecord(sourceValue)) { | ||
@@ -29,0 +29,0 @@ continue; |
import { purry } from "./purry"; | ||
var _minBy = function (indexed) { | ||
return function (array, fn) { | ||
var ret = undefined; | ||
var retMin = undefined; | ||
array.forEach(function (item, i) { | ||
var min = indexed ? fn(item, i, array) : fn(item); | ||
var ret; | ||
var retMin; | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var min = indexed ? fn(item, index, array) : fn(item); | ||
if (retMin === undefined || min < retMin) { | ||
@@ -12,3 +13,3 @@ ret = item; | ||
} | ||
}); | ||
} | ||
return ret; | ||
@@ -15,0 +16,0 @@ }; |
@@ -10,8 +10,10 @@ import { keys } from "./keys"; | ||
} | ||
return keys.strict(object).reduce(function (acc, key) { | ||
var out = {}; | ||
for (var _i = 0, _a = keys.strict(object); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (!fn(object[key], key)) { | ||
acc[key] = object[key]; | ||
out[key] = object[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -6,6 +6,3 @@ import { purry } from "./purry"; | ||
function _only(array) { | ||
if (array.length === 1) { | ||
return array[0]; | ||
} | ||
return undefined; | ||
return array.length === 1 ? array[0] : undefined; | ||
} |
@@ -8,6 +8,7 @@ import { purry } from "./purry"; | ||
var ret = [[], []]; | ||
array.forEach(function (item, index) { | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var matches = indexed ? fn(item, index, array) : fn(item); | ||
ret[matches ? 0 : 1].push(item); | ||
}); | ||
} | ||
return ret; | ||
@@ -14,0 +15,0 @@ }; |
@@ -9,3 +9,3 @@ import { purry } from "./purry"; | ||
var prop = path_1[_i]; | ||
if (current == null) { | ||
if (current === null || current === undefined) { | ||
break; | ||
@@ -12,0 +12,0 @@ } |
@@ -6,8 +6,10 @@ import { purry } from "./purry"; | ||
function _pick(object, names) { | ||
return names.reduce(function (acc, name) { | ||
if (name in object) { | ||
acc[name] = object[name]; | ||
var out = {}; | ||
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { | ||
var name_1 = names_1[_i]; | ||
if (name_1 in object) { | ||
out[name_1] = object[name_1]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -6,12 +6,14 @@ import { keys } from "./keys"; | ||
} | ||
function _pickBy(object, fn) { | ||
if (object == null) { | ||
function _pickBy(data, fn) { | ||
if (data === null || data === undefined) { | ||
return {}; | ||
} | ||
return keys.strict(object).reduce(function (acc, key) { | ||
if (fn(object[key], key)) { | ||
acc[key] = object[key]; | ||
var out = {}; | ||
for (var _i = 0, _a = keys.strict(data); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (fn(data[key], key)) { | ||
out[key] = data[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
return out; | ||
} |
@@ -9,3 +9,3 @@ export function pipe(input) { | ||
var lazyOperations = operations.map(function (op) { | ||
return "lazy" in op ? toPipedLazy(op) : undefined; | ||
return "lazy" in op ? prepareLazyOperation(op) : undefined; | ||
}); | ||
@@ -18,8 +18,8 @@ var operationIndex = 0; | ||
output = operation(output); | ||
operationIndex++; | ||
operationIndex += 1; | ||
continue; | ||
} | ||
var lazySequence = []; | ||
for (var j = operationIndex; j < operations.length; j++) { | ||
var lazyOp = lazyOperations[j]; | ||
for (var index = operationIndex; index < operations.length; index++) { | ||
var lazyOp = lazyOperations[index]; | ||
if (lazyOp === undefined) { | ||
@@ -46,8 +46,3 @@ break; | ||
var isSingle = lazySequence[lazySequence.length - 1].isSingle; | ||
if (isSingle) { | ||
output = accumulator[0]; | ||
} | ||
else { | ||
output = accumulator; | ||
} | ||
output = isSingle ? accumulator[0] : accumulator; | ||
operationIndex += lazySequence.length; | ||
@@ -58,2 +53,3 @@ } | ||
function _processItem(item, accumulator, lazySequence) { | ||
var _a; | ||
if (lazySequence.length === 0) { | ||
@@ -63,16 +59,18 @@ accumulator.push(item); | ||
} | ||
var currentItem = item; | ||
var lazyResult = { done: false, hasNext: false }; | ||
var isDone = false; | ||
for (var i = 0; i < lazySequence.length; i++) { | ||
var lazyFn = lazySequence[i]; | ||
for (var operationsIndex = 0; operationsIndex < lazySequence.length; operationsIndex++) { | ||
var lazyFn = lazySequence[operationsIndex]; | ||
var isIndexed = lazyFn.isIndexed, index = lazyFn.index, items = lazyFn.items; | ||
items.push(item); | ||
lazyResult = isIndexed ? lazyFn(item, index, items) : lazyFn(item); | ||
lazyFn.index++; | ||
items.push(currentItem); | ||
lazyResult = isIndexed | ||
? lazyFn(currentItem, index, items) | ||
: lazyFn(currentItem); | ||
lazyFn.index += 1; | ||
if (lazyResult.hasNext) { | ||
if (lazyResult.hasMany) { | ||
var nextValues = lazyResult.next; | ||
for (var _i = 0, nextValues_1 = nextValues; _i < nextValues_1.length; _i++) { | ||
var subItem = nextValues_1[_i]; | ||
var subResult = _processItem(subItem, accumulator, lazySequence.slice(i + 1)); | ||
if ((_a = lazyResult.hasMany) !== null && _a !== void 0 ? _a : false) { | ||
for (var _i = 0, _b = lazyResult.next; _i < _b.length; _i++) { | ||
var subItem = _b[_i]; | ||
var subResult = _processItem(subItem, accumulator, lazySequence.slice(operationsIndex + 1)); | ||
if (subResult) { | ||
@@ -84,3 +82,3 @@ return true; | ||
} | ||
item = lazyResult.next; | ||
currentItem = lazyResult.next; | ||
} | ||
@@ -95,3 +93,3 @@ if (!lazyResult.hasNext) { | ||
if (lazyResult.hasNext) { | ||
accumulator.push(item); | ||
accumulator.push(currentItem); | ||
} | ||
@@ -103,3 +101,3 @@ if (isDone) { | ||
} | ||
function toPipedLazy(op) { | ||
function prepareLazyOperation(op) { | ||
var lazy = op.lazy, lazyArgs = op.lazyArgs; | ||
@@ -106,0 +104,0 @@ var fn = lazy.apply(void 0, (lazyArgs !== null && lazyArgs !== void 0 ? lazyArgs : [])); |
@@ -10,2 +10,4 @@ import { purry } from "./purry"; | ||
} | ||
var randomChar = function () { return ALPHABET[Math.floor(Math.random() * ALPHABET.length)]; }; | ||
var randomChar = function () { | ||
return ALPHABET[Math.floor(Math.random() * ALPHABET.length)]; | ||
}; |
@@ -10,3 +10,3 @@ import { purryOrderRulesWithArgument } from "./_purryOrderRules"; | ||
if (compareFn(targetItem, item) > 0) { | ||
rank++; | ||
rank += 1; | ||
} | ||
@@ -13,0 +13,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { purry } from "./purry"; | ||
export function reject() { | ||
@@ -14,15 +14,6 @@ return purry(_reject(false), arguments, reject.lazy); | ||
return function (fn) { | ||
return function (value, index, array) { | ||
var valid = indexed ? fn(value, index, array) : fn(value); | ||
if (!valid) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return function (item, index, data) { | ||
return (indexed ? fn(item, index, data) : fn(item)) | ||
? { done: false, hasNext: false } | ||
: { done: false, hasNext: true, next: item }; | ||
}; | ||
@@ -29,0 +20,0 @@ }; |
@@ -17,3 +17,3 @@ import { purry } from "./purry"; | ||
if (sampleSize >= data.length) { | ||
return data; | ||
return data.slice(); | ||
} | ||
@@ -20,0 +20,0 @@ if (sampleSize === 0) { |
@@ -7,3 +7,3 @@ import { purry } from "./purry"; | ||
var result = items.slice(); | ||
for (var index = 0; index < items.length; index += 1) { | ||
for (var index = 0; index < items.length; index++) { | ||
var rand = index + Math.floor(Math.random() * (items.length - index)); | ||
@@ -10,0 +10,0 @@ var value = result[rand]; |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { purry } from "./purry"; | ||
@@ -15,3 +6,3 @@ export function sort() { | ||
function _sort(items, cmp) { | ||
var ret = __spreadArray([], items, true); | ||
var ret = items.slice(); | ||
ret.sort(cmp); | ||
@@ -18,0 +9,0 @@ return ret; |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { purryOrderRules } from "./_purryOrderRules"; | ||
@@ -15,3 +6,3 @@ export function sortBy() { | ||
var _sortBy = function (data, compareFn) { | ||
return __spreadArray([], data, true).sort(compareFn); | ||
return data.slice().sort(compareFn); | ||
}; | ||
@@ -18,0 +9,0 @@ (function (sortBy) { |
@@ -15,5 +15,5 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
function _splice(items, start, deleteCount, replacement) { | ||
var result = __spreadArray([], items, true); | ||
var result = items.slice(); | ||
result.splice.apply(result, __spreadArray([start, deleteCount], replacement, false)); | ||
return result; | ||
} |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { purry } from "./purry"; | ||
@@ -15,5 +6,5 @@ export function splitAt() { | ||
function _splitAt(array, index) { | ||
var copy = __spreadArray([], array, true); | ||
var copy = array.slice(); | ||
var tail = copy.splice(index); | ||
return [copy, tail]; | ||
} |
@@ -12,3 +12,3 @@ import { splitAt } from "./splitAt"; | ||
} | ||
return [array, []]; | ||
return [array.slice(), []]; | ||
} |
@@ -18,4 +18,4 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
} | ||
var match = (_a = /^\[(.+?)\](.*)$/.exec(path)) !== null && _a !== void 0 ? _a : /^\.?([^.[\]]+)(.*)$/.exec(path); | ||
if (match) { | ||
var match = (_a = /^\[(.+?)\](.*)$/u.exec(path)) !== null && _a !== void 0 ? _a : /^\.?([^.[\]]+)(.*)$/u.exec(path); | ||
if (match !== null) { | ||
var key = match[1], rest = match[2]; | ||
@@ -22,0 +22,0 @@ return __spreadArray([key], _stringToPath(rest), true); |
@@ -5,6 +5,7 @@ import { purry } from "./purry"; | ||
var sum = 0; | ||
array.forEach(function (item, i) { | ||
var summand = indexed ? fn(item, i, array) : fn(item); | ||
for (var index = 0; index < array.length; index++) { | ||
var item = array[index]; | ||
var summand = indexed ? fn(item, index, array) : fn(item); | ||
sum += summand; | ||
}); | ||
} | ||
return sum; | ||
@@ -11,0 +12,0 @@ }; |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function take() { | ||
@@ -11,22 +11,9 @@ return purry(_take, arguments, take.lazy); | ||
function lazy(n) { | ||
if (n <= 0) { | ||
return function () { return ({ done: true, hasNext: false }); }; | ||
} | ||
var remaining = n; | ||
return function (value) { | ||
if (n === 0) { | ||
return { | ||
done: true, | ||
hasNext: false, | ||
}; | ||
} | ||
n--; | ||
if (n === 0) { | ||
return { | ||
done: true, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
remaining -= 1; | ||
return { done: remaining <= 0, hasNext: true, next: value }; | ||
}; | ||
@@ -33,0 +20,0 @@ } |
@@ -1,10 +0,1 @@ | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
import { heapify, heapMaybeInsert } from "./_heap"; | ||
@@ -20,3 +11,3 @@ import { purryOrderRulesWithArgument } from "./_purryOrderRules"; | ||
if (n >= data.length) { | ||
return __spreadArray([], data, true); | ||
return data.slice(); | ||
} | ||
@@ -23,0 +14,0 @@ var heap = data.slice(0, n); |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function uniq() { | ||
@@ -14,13 +14,6 @@ return purry(_uniq, arguments, uniq.lazy); | ||
if (set.has(value)) { | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return { done: false, hasNext: false }; | ||
} | ||
set.add(value); | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
@@ -27,0 +20,0 @@ } |
@@ -0,3 +1,3 @@ | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
export function uniqBy() { | ||
@@ -14,14 +14,7 @@ return purry(_uniqBy, arguments, lazyUniqBy); | ||
if (set.has(appliedItem)) { | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return { done: false, hasNext: false }; | ||
} | ||
set.add(appliedItem); | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
return { done: false, hasNext: true, next: value }; | ||
}; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { purry } from "./purry"; | ||
import { _reduceLazy } from "./_reduceLazy"; | ||
import { _toLazyIndexed } from "./_toLazyIndexed"; | ||
import { purry } from "./purry"; | ||
export function uniqWith() { | ||
@@ -11,20 +11,12 @@ return purry(_uniqWith, arguments, uniqWith.lazy); | ||
} | ||
function _lazy(isEquals) { | ||
var _lazy = function (isEquals) { | ||
return function (value, index, array) { | ||
if (array && | ||
array.findIndex(function (otherValue) { return isEquals(value, otherValue); }) === index) { | ||
return { | ||
done: false, | ||
hasNext: true, | ||
next: value, | ||
}; | ||
} | ||
return { | ||
done: false, | ||
hasNext: false, | ||
}; | ||
return array !== undefined && | ||
array.findIndex(function (otherValue) { return isEquals(value, otherValue); }) === index | ||
? { done: false, hasNext: true, next: value } | ||
: { done: false, hasNext: false }; | ||
}; | ||
} | ||
}; | ||
(function (uniqWith) { | ||
uniqWith.lazy = _toLazyIndexed(_lazy); | ||
})(uniqWith || (uniqWith = {})); |
@@ -30,3 +30,3 @@ /** | ||
type NarrowRaw<A> = (A extends [] ? [] : never) | (A extends Narrowable ? A : never) | { | ||
[K in keyof A]: A[K] extends (...args: Array<unknown>) => unknown ? A[K] : NarrowRaw<A[K]>; | ||
[K in keyof A]: A[K] extends (...args: ReadonlyArray<unknown>) => unknown ? A[K] : NarrowRaw<A[K]>; | ||
}; | ||
@@ -33,0 +33,0 @@ /** |
@@ -6,5 +6,5 @@ export type Path<Obj, Prefix extends Array<PropertyKey> = []> = Obj extends Primitive ? Prefix : Obj extends Array<infer Item> ? Path<Item, [...Prefix, number]> | Prefix : PathsOfObject<Obj, Prefix> | Prefix; | ||
export type ValueAtPath<Obj, ObjPath extends Array<PropertyKey> = []> = ObjPath extends [] ? Obj : ObjPath extends [infer Head, ...infer Tail] ? Tail extends Array<PropertyKey> ? Head extends keyof Obj ? ValueAtPath<Obj[Head], Tail> : never : never : never; | ||
export type SupportsValueAtPath<Obj, Path extends Array<PropertyKey>, Value> = Value extends ValueAtPath<Obj, Path> ? Obj : never; | ||
export type SupportsValueAtPath<Obj, P extends Array<PropertyKey>, Value> = Value extends ValueAtPath<Obj, P> ? Obj : never; | ||
type Primitive = boolean | number | string | symbol | null | undefined; | ||
export {}; | ||
//# sourceMappingURL=_paths.d.ts.map |
@@ -1,22 +0,3 @@ | ||
export type LazyResult<T> = LazyEmpty | LazyMany<T> | LazyNext<T>; | ||
type LazyEmpty = { | ||
done: boolean; | ||
hasNext: false; | ||
hasMany?: false | undefined; | ||
next?: undefined; | ||
}; | ||
type LazyNext<T> = { | ||
done: boolean; | ||
hasNext: true; | ||
hasMany?: false | undefined; | ||
next: T; | ||
}; | ||
type LazyMany<T> = { | ||
done: boolean; | ||
hasNext: true; | ||
hasMany: true; | ||
next: Array<T>; | ||
}; | ||
export declare function _reduceLazy<T, K>(array: ReadonlyArray<T>, lazy: (item: T, index?: number, array?: ReadonlyArray<T>) => LazyResult<K>, indexed?: boolean): Array<K>; | ||
export {}; | ||
import type { LazyEvaluator } from "./pipe"; | ||
export declare function _reduceLazy<T, K>(array: ReadonlyArray<T>, lazy: LazyEvaluator<T, K>, isIndexed?: boolean): Array<K>; | ||
//# sourceMappingURL=_reduceLazy.d.ts.map |
@@ -1,4 +0,6 @@ | ||
export declare const _toSingle: <Func extends (...args: any) => unknown>(fn: Func) => Func & { | ||
single: true; | ||
type Single<Func> = Func & { | ||
readonly single: true; | ||
}; | ||
export declare const _toSingle: <Func extends (...args: any) => unknown>(fn: Func) => Single<Func>; | ||
export {}; | ||
//# sourceMappingURL=_toSingle.d.ts.map |
import type { IsAny } from "./type-fest/is-any"; | ||
export type Pred<T, K> = (input: T) => K; | ||
export type PredIndexed<T, K> = (input: T, index: number, array: Array<T>) => K; | ||
export type PredIndexed<T, K> = (input: T, index: number, array: ReadonlyArray<T>) => K; | ||
export type PredIndexedOptional<T, K> = (input: T, index?: number, array?: ReadonlyArray<T>) => K; | ||
@@ -18,3 +18,3 @@ export type NonEmptyArray<T> = [T, ...Array<T>]; | ||
*/ | ||
export type IterableContainer<T = unknown> = ReadonlyArray<T> | []; | ||
export type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly []; | ||
export type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`; | ||
@@ -21,0 +21,0 @@ /** |
@@ -0,1 +1,5 @@ | ||
type Limits = { | ||
readonly min?: number; | ||
readonly max?: number; | ||
}; | ||
/** | ||
@@ -14,6 +18,3 @@ * Clamp the given value within the inclusive min and max bounds. | ||
*/ | ||
export declare function clamp(value: number, limits: { | ||
min?: number; | ||
max?: number; | ||
}): number; | ||
export declare function clamp(value: number, limits: Limits): number; | ||
/** | ||
@@ -32,6 +33,4 @@ * Clamp the given value within the inclusive min and max bounds. | ||
*/ | ||
export declare function clamp(limits: { | ||
min?: number; | ||
max?: number; | ||
}): (value: number) => number; | ||
export declare function clamp(limits: Limits): (value: number) => number; | ||
export {}; | ||
//# sourceMappingURL=clamp.d.ts.map |
/** | ||
* Filter out all falsey values. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are falsey. | ||
* Filter out all falsy values. The values `false`, `null`, `0`, `""`, | ||
* `undefined`, and `NaN` are falsy. | ||
* | ||
* **DEPRECATED: equivalent to `R.filter(R.isTruthy)` and so will be removed in v2.** | ||
* **DEPRECATED: equivalent to `R.filter(R.isTruthy)` and so will be removed in | ||
* v2.** | ||
* | ||
@@ -6,0 +8,0 @@ * @param items the array to compact |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -33,4 +33,4 @@ * Excludes the values from `other` array. | ||
export declare namespace difference { | ||
function lazy<T>(other: Array<T>): (value: T) => LazyResult<T>; | ||
function lazy<T>(other: ReadonlyArray<T>): LazyEvaluator<T>; | ||
} | ||
//# sourceMappingURL=difference.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type IsEquals<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean; | ||
@@ -45,5 +45,5 @@ /** | ||
export declare namespace differenceWith { | ||
function lazy<TFirst, TSecond>(other: Array<TSecond>, isEquals: IsEquals<TFirst, TSecond>): (value: TFirst) => LazyResult<TFirst>; | ||
const lazy: <TFirst, TSecond>(other: readonly TSecond[], isEquals: IsEquals<TFirst, TSecond>) => LazyEvaluator<TFirst>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=differenceWith.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -29,4 +29,4 @@ * Removes first `n` elements from the `array`. | ||
export declare namespace drop { | ||
function lazy<T>(n: number): (value: T) => LazyResult<T>; | ||
function lazy<T>(n: number): LazyEvaluator<T>; | ||
} | ||
//# sourceMappingURL=drop.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { Pred, PredIndexedOptional, PredIndexed } from "./_types"; | ||
import type { Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -37,3 +37,3 @@ * Filter the elements of an array that meet the condition specified in a callback function. | ||
export declare namespace filter { | ||
function indexed<T, S extends T>(array: ReadonlyArray<T>, fn: (input: T, index: number, array: Array<T>) => input is S): Array<S>; | ||
function indexed<T, S extends T>(array: ReadonlyArray<T>, fn: (input: T, index: number, array: ReadonlyArray<T>) => input is S): Array<S>; | ||
function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): Array<T>; | ||
@@ -43,6 +43,6 @@ /** | ||
*/ | ||
function indexed<T, S extends T>(fn: (input: T, index: number, array: Array<T>) => input is S): (array: ReadonlyArray<T>) => Array<S>; | ||
function indexed<T, S extends T>(fn: (input: T, index: number, array: ReadonlyArray<T>) => input is S): (array: ReadonlyArray<T>) => Array<S>; | ||
function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<T>; | ||
const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & { | ||
const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>) & { | ||
readonly indexed: true; | ||
@@ -49,0 +49,0 @@ }; |
@@ -1,2 +0,3 @@ | ||
import type { Pred, PredIndexedOptional, PredIndexed } from "./_types"; | ||
import type { Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -42,19 +43,11 @@ * Returns the value of the first element in the array where predicate is true, and undefined otherwise. | ||
function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => T | undefined; | ||
const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: T; | ||
}) & { | ||
single: true; | ||
const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>) & { | ||
readonly single: true; | ||
}; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: T; | ||
}) & { | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>) & { | ||
readonly indexed: true; | ||
} & { | ||
single: true; | ||
readonly single: true; | ||
}; | ||
} | ||
//# sourceMappingURL=find.d.ts.map |
@@ -1,2 +0,3 @@ | ||
import type { Pred, PredIndexedOptional, PredIndexed } from "./_types"; | ||
import type { Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -43,27 +44,11 @@ * Returns the index of the first element in the array where predicate is true, and -1 otherwise. | ||
function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => number; | ||
const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: number; | ||
} | { | ||
done: boolean; | ||
hasNext: boolean; | ||
next?: never; | ||
}) & { | ||
single: true; | ||
const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T, number>) & { | ||
readonly single: true; | ||
}; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: number; | ||
} | { | ||
done: boolean; | ||
hasNext: boolean; | ||
next?: never; | ||
}) & { | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T, number>) & { | ||
readonly indexed: true; | ||
} & { | ||
single: true; | ||
readonly single: true; | ||
}; | ||
} | ||
//# sourceMappingURL=findIndex.d.ts.map |
import type { IterableContainer } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type First<T extends IterableContainer> = T extends [] ? undefined : T extends readonly [unknown, ...Array<unknown>] ? T[0] : T extends readonly [...infer Pre, infer Last] ? Last | Pre[0] : T[0] | undefined; | ||
@@ -38,7 +39,3 @@ /** | ||
export declare namespace first { | ||
function lazy<T>(): (value: T) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: T; | ||
}; | ||
function lazy<T>(): LazyEvaluator<T>; | ||
namespace lazy { | ||
@@ -45,0 +42,0 @@ const single = true; |
@@ -0,1 +1,2 @@ | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -28,14 +29,4 @@ * Map each element of an array using a defined callback function and flatten the mapped result. | ||
export declare namespace flatMap { | ||
function lazy<T, K>(fn: (input: T) => K | ReadonlyArray<K>): (value: T) => { | ||
done: boolean; | ||
hasNext: boolean; | ||
hasMany: boolean; | ||
next: K & any[]; | ||
} | { | ||
done: boolean; | ||
hasNext: boolean; | ||
next: K | readonly K[]; | ||
hasMany?: never; | ||
}; | ||
const lazy: <T, K>(fn: (input: T) => K | readonly K[]) => LazyEvaluator<T, K>; | ||
} | ||
//# sourceMappingURL=flatMap.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type Flatten<T> = T extends ReadonlyArray<infer K> ? K : T; | ||
@@ -33,5 +33,5 @@ /** | ||
export declare namespace flatten { | ||
function lazy<T>(): (next: T) => LazyResult<unknown>; | ||
const lazy: <T>() => LazyEvaluator<T, Flatten<T>>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=flatten.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type FlattenDeep<T> = T extends ReadonlyArray<infer K> ? FlattenDeep2<K> : T; | ||
@@ -33,5 +33,5 @@ type FlattenDeep2<T> = T extends ReadonlyArray<infer K> ? FlattenDeep3<K> : T; | ||
export declare namespace flattenDeep { | ||
function lazy(): (value: any) => LazyResult<any>; | ||
const lazy: <T>() => LazyEvaluator<T, any>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=flattenDeep.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { Pred, PredIndexedOptional, PredIndexed } from "./_types"; | ||
import type { Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -52,4 +52,4 @@ * Iterate an array using a defined callback function. The original array is returned instead of `void`. | ||
function indexed<T>(fn: PredIndexed<T, void>): (array: ReadonlyArray<T>) => Array<T>; | ||
const lazy: <T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & { | ||
const lazy: <T>(fn: PredIndexedOptional<T, void>) => LazyEvaluator<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, void>) => LazyEvaluator<T>) & { | ||
readonly indexed: true; | ||
@@ -56,0 +56,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -29,4 +29,4 @@ * Returns a list of elements that exist in both array. | ||
export declare namespace intersection { | ||
function lazy<T>(other: Array<T>): (value: T) => LazyResult<T>; | ||
function lazy<T>(other: ReadonlyArray<T>): LazyEvaluator<T>; | ||
} | ||
//# sourceMappingURL=intersection.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type Comparator<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean; | ||
@@ -51,5 +51,5 @@ /** | ||
export declare namespace intersectionWith { | ||
function lazy<TFirst, TSecond>(other: Array<TSecond>, comparator: Comparator<TFirst, TSecond>): (value: TFirst) => LazyResult<TFirst>; | ||
const lazy: <TFirst, TSecond>(other: readonly TSecond[], comparator: Comparator<TFirst, TSecond>) => LazyEvaluator<TFirst>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=intersectionWith.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import type { IterableContainer } from "./_types"; | ||
/** | ||
@@ -27,4 +28,4 @@ * A function that checks if the passed parameter is empty. | ||
export declare function isEmpty<T extends string | undefined>(data: T): data is ("" extends T ? "" : never) | (undefined extends T ? undefined : never); | ||
export declare function isEmpty(data: ReadonlyArray<unknown> | []): data is []; | ||
export declare function isEmpty(data: IterableContainer): data is []; | ||
export declare function isEmpty<T extends Readonly<Record<PropertyKey, unknown>>>(data: T): data is Record<keyof T, never>; | ||
//# sourceMappingURL=isEmpty.d.ts.map |
@@ -27,3 +27,3 @@ import type { NarrowedTo } from "./_types"; | ||
*/ | ||
export declare function isPlainObject<T>(data: Record<PropertyKey, unknown> | T): data is NarrowedTo<T, Record<PropertyKey, unknown>>; | ||
export declare function isPlainObject<T>(data: Readonly<Record<PropertyKey, unknown>> | T): data is NarrowedTo<T, Record<PropertyKey, unknown>>; | ||
//# sourceMappingURL=isPlainObject.d.ts.map |
@@ -25,3 +25,3 @@ import type { IterableContainer } from "./_types"; | ||
*/ | ||
export declare function keys(source: ArrayLike<unknown> | Record<PropertyKey, unknown>): Array<string>; | ||
export declare function keys(source: ArrayLike<unknown> | Readonly<Record<PropertyKey, unknown>>): Array<string>; | ||
type Strict = <T extends object>(data: T) => Keys<T>; | ||
@@ -28,0 +28,0 @@ type Keys<T> = T extends IterableContainer ? ArrayKeys<T> : ObjectKeys<T>; |
@@ -14,3 +14,3 @@ import type { NonEmptyArray } from "./_types"; | ||
*/ | ||
export declare function last<T>(array: NonEmptyArray<T>): T; | ||
export declare function last<T>(array: Readonly<NonEmptyArray<T>>): T; | ||
export declare function last<T>(array: ReadonlyArray<T>): T | undefined; | ||
@@ -17,0 +17,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { IterableContainer, Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -55,4 +55,4 @@ * Map each element of an array using a defined callback function. If the input | ||
function indexed<T, K>(fn: PredIndexed<T, K>): (array: ReadonlyArray<T>) => Array<K>; | ||
const lazy: <T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<K>; | ||
const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<K>) & { | ||
const lazy: <T, K>(fn: PredIndexedOptional<T, K>) => LazyEvaluator<T, K>; | ||
const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => LazyEvaluator<T, K>) & { | ||
readonly indexed: true; | ||
@@ -59,0 +59,0 @@ }; |
@@ -14,4 +14,4 @@ /** | ||
export declare function mergeAll<A, B, C, D>(array: readonly [A, B, C, D]): A & B & C & D; | ||
export declare function mergeAll<A, B, C, D, E>(array: [A, B, C, D, E]): A & B & C & D & E; | ||
export declare function mergeAll<A, B, C, D, E>(array: readonly [A, B, C, D, E]): A & B & C & D & E; | ||
export declare function mergeAll(array: ReadonlyArray<object>): object; | ||
//# sourceMappingURL=mergeAll.d.ts.map |
@@ -0,1 +1,21 @@ | ||
export type LazyEvaluator<T = unknown, R = T> = (item: T, index?: number, data?: ReadonlyArray<T>) => LazyResult<R>; | ||
type LazyResult<T> = LazyEmpty | LazyMany<T> | LazyNext<T>; | ||
type LazyEmpty = { | ||
done: boolean; | ||
hasNext: false; | ||
hasMany?: false | undefined; | ||
next?: undefined; | ||
}; | ||
type LazyNext<T> = { | ||
done: boolean; | ||
hasNext: true; | ||
hasMany?: false | undefined; | ||
next: T; | ||
}; | ||
type LazyMany<T> = { | ||
done: boolean; | ||
hasNext: true; | ||
hasMany: true; | ||
next: Array<T>; | ||
}; | ||
/** | ||
@@ -32,2 +52,3 @@ * Perform left-to-right function composition. | ||
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L, op12: (input: L) => M, op13: (input: M) => N, op14: (input: N) => O, op15: (input: O) => P): P; | ||
export {}; | ||
//# sourceMappingURL=pipe.d.ts.map |
@@ -1,12 +0,21 @@ | ||
type LazyFactory = (...args: any) => unknown; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type LazyEvaluatorFactory = (...args: any) => LazyEvaluator; | ||
type MaybeLazyFunction = { | ||
(...args: any): unknown; | ||
lazy?: LazyFactory; | ||
readonly lazy?: LazyEvaluatorFactory; | ||
}; | ||
/** | ||
* Creates a function with `data-first` and `data-last` signatures. | ||
* Creates a function with `dataFirst` and `dataLast` signatures. | ||
* | ||
* `purry` is a dynamic function and it's not type safe. It should be wrapped by a function that have proper typings. | ||
* Refer to the example below for correct usage. | ||
* `purry` is a dynamic function and it's not type safe. It should be wrapped by | ||
* a function that have proper typings. Refer to the example below for correct | ||
* usage. | ||
* | ||
* !IMPORTANT: functions that simply call `purry` and return the result (like | ||
* almost all functions in this library) should return `unknown` themselves if | ||
* an explicit return type is required. This is because we currently don't | ||
* provide a generic return type that is built from the input function, and | ||
* crafting one manually isn't worthwhile as we rely on function declaration | ||
* overloading to combine the types for dataFirst and dataLast invocations! | ||
* | ||
* @param fn the function to purry. | ||
@@ -36,4 +45,4 @@ * @param args the arguments | ||
*/ | ||
export declare function purry(fn: MaybeLazyFunction, args: IArguments | ReadonlyArray<unknown>, lazyFactory?: LazyFactory): unknown; | ||
export declare function purry(fn: MaybeLazyFunction, args: IArguments | ReadonlyArray<unknown>, lazyFactory?: LazyEvaluatorFactory): unknown; | ||
export {}; | ||
//# sourceMappingURL=purry.d.ts.map |
@@ -32,5 +32,5 @@ /** | ||
export declare namespace reduce { | ||
function indexed<T, K>(array: ReadonlyArray<T>, fn: (acc: K, item: T, index: number, items: Array<T>) => K, initialValue: K): K; | ||
function indexed<T, K>(fn: (acc: K, item: T, index: number, items: Array<T>) => K, initialValue: K): (array: ReadonlyArray<T>) => K; | ||
function indexed<T, K>(array: ReadonlyArray<T>, fn: (acc: K, item: T, index: number, items: ReadonlyArray<T>) => K, initialValue: K): K; | ||
function indexed<T, K>(fn: (acc: K, item: T, index: number, items: ReadonlyArray<T>) => K, initialValue: K): (array: ReadonlyArray<T>) => K; | ||
} | ||
//# sourceMappingURL=reduce.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { Pred, PredIndexedOptional, PredIndexed } from "./_types"; | ||
import type { Pred, PredIndexed, PredIndexedOptional } from "./_types"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -38,4 +38,4 @@ * Reject the elements of an array that meet the condition specified in a callback function. | ||
function indexed<T, K>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<K>; | ||
const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & { | ||
const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>; | ||
const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => LazyEvaluator<T>) & { | ||
readonly indexed: true; | ||
@@ -42,0 +42,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -28,4 +28,4 @@ * Returns the first `n` elements of `array`. | ||
export declare namespace take { | ||
function lazy<T>(n: number): (value: T) => LazyResult<T>; | ||
function lazy<T>(n: number): LazyEvaluator<T>; | ||
} | ||
//# sourceMappingURL=take.d.ts.map |
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export declare function toPairs<T>(object: Record<string, T>): Array<[string, T]>; | ||
export declare function toPairs<T>(object: Readonly<Record<string, T>>): Array<[string, T]>; | ||
type Pairs<T> = Array<{ | ||
@@ -25,0 +25,0 @@ [K in keyof T]-?: [key: K, value: Required<T>[K]]; |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
/** | ||
@@ -33,4 +33,4 @@ * Returns a new array containing only one copy of each element in the original list. | ||
export declare namespace uniq { | ||
function lazy<T>(): (value: T) => LazyResult<T>; | ||
function lazy<T>(): LazyEvaluator<T>; | ||
} | ||
//# sourceMappingURL=uniq.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { LazyResult } from "./_reduceLazy"; | ||
import type { LazyEvaluator } from "./pipe"; | ||
type IsEquals<T> = (a: T, b: T) => boolean; | ||
@@ -37,5 +37,4 @@ /** | ||
export declare function uniqWith<T>(isEquals: IsEquals<T>): (array: ReadonlyArray<T>) => Array<T>; | ||
declare function _lazy<T>(isEquals: IsEquals<T>): (value: T, index?: number, array?: ReadonlyArray<T>) => LazyResult<T>; | ||
export declare namespace uniqWith { | ||
const lazy: typeof _lazy & { | ||
const lazy: (<T>(isEquals: IsEquals<T>) => LazyEvaluator<T>) & { | ||
readonly indexed: true; | ||
@@ -42,0 +41,0 @@ }; |
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
export declare function zipObj<F extends number | string | symbol, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Record<F, S>; | ||
export declare function zipObj<F extends PropertyKey, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Record<F, S>; | ||
/** | ||
@@ -26,3 +26,3 @@ * Creates a new object from two supplied lists by pairing up equally-positioned items. | ||
*/ | ||
export declare function zipObj<S>(second: ReadonlyArray<S>): <F extends number | string | symbol>(first: ReadonlyArray<F>) => Record<F, S>; | ||
export declare function zipObj<S>(second: ReadonlyArray<S>): <F extends PropertyKey>(first: ReadonlyArray<F>) => Record<F, S>; | ||
//# sourceMappingURL=zipObj.d.ts.map |
{ | ||
"name": "remeda", | ||
"version": "1.46.2", | ||
"version": "1.47.0", | ||
"description": "A utility library for JavaScript and Typescript.", | ||
@@ -49,4 +49,7 @@ "keywords": [ | ||
"@types/eslint__js": "^8.42.3", | ||
"@types/eslint-config-prettier": "^6.11.3", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-unicorn": "^51.0.1", | ||
"husky": "^9.0.11", | ||
@@ -53,0 +56,0 @@ "lint-staged": "^15.2.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
536213
14
10893