es-toolkit 1.15.1-dev.445 → 1.15.1-dev.446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/function/rest.d.mts +12 -0
- package/dist/compat/function/rest.d.ts +12 -0
- package/dist/compat/function/rest.mjs +11 -0
- package/dist/compat/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +9 -0
- package/dist/compat/index.mjs +1 -0
- package/dist/function/index.d.mts +1 -0
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.js +12 -0
- package/dist/function/index.mjs +1 -0
- package/dist/function/rest.d.mts +12 -0
- package/dist/function/rest.d.ts +12 -0
- package/dist/function/rest.mjs +12 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with the this binding of the created function and arguments from start and beyond provided as an array.
|
|
3
|
+
*
|
|
4
|
+
* @template F The type of the function.
|
|
5
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
6
|
+
* @param {number} start The start position of the rest parameter.
|
|
7
|
+
* @returns {Function} Returns the new function.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function rest<F extends (...args: any[]) => any>(func: F, start?: number): (...args: any[]) => ReturnType<F>;
|
|
11
|
+
|
|
12
|
+
export { rest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with the this binding of the created function and arguments from start and beyond provided as an array.
|
|
3
|
+
*
|
|
4
|
+
* @template F The type of the function.
|
|
5
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
6
|
+
* @param {number} start The start position of the rest parameter.
|
|
7
|
+
* @returns {Function} Returns the new function.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function rest<F extends (...args: any[]) => any>(func: F, start?: number): (...args: any[]) => ReturnType<F>;
|
|
11
|
+
|
|
12
|
+
export { rest };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { rest as rest$1 } from '../../function/rest.mjs';
|
|
2
|
+
|
|
3
|
+
function rest(func, start = func.length - 1) {
|
|
4
|
+
start = Number.parseInt(start, 10);
|
|
5
|
+
if (Number.isNaN(start) || start < 0) {
|
|
6
|
+
start = func.length - 1;
|
|
7
|
+
}
|
|
8
|
+
return rest$1(func, start);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { rest };
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -108,6 +108,7 @@ export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
|
108
108
|
export { indexOf } from './array/indexOf.mjs';
|
|
109
109
|
export { ary } from './function/ary.mjs';
|
|
110
110
|
export { bind } from './function/bind.mjs';
|
|
111
|
+
export { rest } from './function/rest.mjs';
|
|
111
112
|
export { get } from './object/get.mjs';
|
|
112
113
|
export { set } from './object/set.mjs';
|
|
113
114
|
export { has } from './object/has.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ export { zipObjectDeep } from './array/zipObjectDeep.js';
|
|
|
108
108
|
export { indexOf } from './array/indexOf.js';
|
|
109
109
|
export { ary } from './function/ary.js';
|
|
110
110
|
export { bind } from './function/bind.js';
|
|
111
|
+
export { rest } from './function/rest.js';
|
|
111
112
|
export { get } from './object/get.js';
|
|
112
113
|
export { set } from './object/set.js';
|
|
113
114
|
export { has } from './object/has.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -601,6 +601,14 @@ function bind(func, thisObj, ...partialArgs) {
|
|
|
601
601
|
const bindPlaceholder = Symbol('bind.placeholder');
|
|
602
602
|
bind.placeholder = bindPlaceholder;
|
|
603
603
|
|
|
604
|
+
function rest(func, start = func.length - 1) {
|
|
605
|
+
start = Number.parseInt(start, 10);
|
|
606
|
+
if (Number.isNaN(start) || start < 0) {
|
|
607
|
+
start = func.length - 1;
|
|
608
|
+
}
|
|
609
|
+
return function_index.rest(func, start);
|
|
610
|
+
}
|
|
611
|
+
|
|
604
612
|
function identity(x) {
|
|
605
613
|
return x;
|
|
606
614
|
}
|
|
@@ -936,6 +944,7 @@ exports.orderBy = orderBy;
|
|
|
936
944
|
exports.padEnd = padEnd;
|
|
937
945
|
exports.padStart = padStart;
|
|
938
946
|
exports.property = property;
|
|
947
|
+
exports.rest = rest;
|
|
939
948
|
exports.set = set;
|
|
940
949
|
exports.size = size;
|
|
941
950
|
exports.startsWith = startsWith;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -109,6 +109,7 @@ export { zipObjectDeep } from './array/zipObjectDeep.mjs';
|
|
|
109
109
|
export { indexOf } from './array/indexOf.mjs';
|
|
110
110
|
export { ary } from './function/ary.mjs';
|
|
111
111
|
export { bind } from './function/bind.mjs';
|
|
112
|
+
export { rest } from './function/rest.mjs';
|
|
112
113
|
export { get } from './object/get.mjs';
|
|
113
114
|
export { set } from './object/set.mjs';
|
|
114
115
|
export { has } from './object/has.mjs';
|
package/dist/function/index.d.ts
CHANGED
package/dist/function/index.js
CHANGED
|
@@ -143,6 +143,17 @@ function partialRight(func, ...partialArgs) {
|
|
|
143
143
|
const partialRightPlaceholder = Symbol('partialRight.placeholder');
|
|
144
144
|
partialRight.placeholder = partialRightPlaceholder;
|
|
145
145
|
|
|
146
|
+
function rest(func, start = func.length - 1) {
|
|
147
|
+
return function (...args) {
|
|
148
|
+
const rest = args.slice(start);
|
|
149
|
+
const params = args.slice(0, start);
|
|
150
|
+
while (params.length < start) {
|
|
151
|
+
params.push(undefined);
|
|
152
|
+
}
|
|
153
|
+
return func.apply(this, [...params, rest]);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
146
157
|
exports.after = after;
|
|
147
158
|
exports.ary = ary;
|
|
148
159
|
exports.before = before;
|
|
@@ -152,5 +163,6 @@ exports.noop = noop;
|
|
|
152
163
|
exports.once = once;
|
|
153
164
|
exports.partial = partial;
|
|
154
165
|
exports.partialRight = partialRight;
|
|
166
|
+
exports.rest = rest;
|
|
155
167
|
exports.throttle = throttle;
|
|
156
168
|
exports.unary = unary;
|
package/dist/function/index.mjs
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with the this binding of the created function and arguments from start and beyond provided as an array.
|
|
3
|
+
*
|
|
4
|
+
* @template F The type of the function.
|
|
5
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
6
|
+
* @param {number} start The start position of the rest parameter.
|
|
7
|
+
* @returns {Function} Returns the new function.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function rest<F extends (...args: any[]) => any>(func: F, start?: number): (...args: any[]) => ReturnType<F>;
|
|
11
|
+
|
|
12
|
+
export { rest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a function that invokes `func` with the this binding of the created function and arguments from start and beyond provided as an array.
|
|
3
|
+
*
|
|
4
|
+
* @template F The type of the function.
|
|
5
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
6
|
+
* @param {number} start The start position of the rest parameter.
|
|
7
|
+
* @returns {Function} Returns the new function.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare function rest<F extends (...args: any[]) => any>(func: F, start?: number): (...args: any[]) => ReturnType<F>;
|
|
11
|
+
|
|
12
|
+
export { rest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function rest(func, start = func.length - 1) {
|
|
2
|
+
return function (...args) {
|
|
3
|
+
const rest = args.slice(start);
|
|
4
|
+
const params = args.slice(0, start);
|
|
5
|
+
while (params.length < start) {
|
|
6
|
+
params.push(undefined);
|
|
7
|
+
}
|
|
8
|
+
return func.apply(this, [...params, rest]);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { rest };
|
package/dist/index.d.mts
CHANGED
|
@@ -64,6 +64,7 @@ export { ary } from './function/ary.mjs';
|
|
|
64
64
|
export { unary } from './function/unary.mjs';
|
|
65
65
|
export { partial } from './function/partial.mjs';
|
|
66
66
|
export { partialRight } from './function/partialRight.mjs';
|
|
67
|
+
export { rest } from './function/rest.mjs';
|
|
67
68
|
export { clamp } from './math/clamp.mjs';
|
|
68
69
|
export { inRange } from './math/inRange.mjs';
|
|
69
70
|
export { mean } from './math/mean.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export { ary } from './function/ary.js';
|
|
|
64
64
|
export { unary } from './function/unary.js';
|
|
65
65
|
export { partial } from './function/partial.js';
|
|
66
66
|
export { partialRight } from './function/partialRight.js';
|
|
67
|
+
export { rest } from './function/rest.js';
|
|
67
68
|
export { clamp } from './math/clamp.js';
|
|
68
69
|
export { inRange } from './math/inRange.js';
|
|
69
70
|
export { mean } from './math/mean.js';
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,7 @@ exports.noop = function_index.noop;
|
|
|
83
83
|
exports.once = function_index.once;
|
|
84
84
|
exports.partial = function_index.partial;
|
|
85
85
|
exports.partialRight = function_index.partialRight;
|
|
86
|
+
exports.rest = function_index.rest;
|
|
86
87
|
exports.throttle = function_index.throttle;
|
|
87
88
|
exports.unary = function_index.unary;
|
|
88
89
|
exports.clamp = math_index.clamp;
|
package/dist/index.mjs
CHANGED
|
@@ -64,6 +64,7 @@ export { ary } from './function/ary.mjs';
|
|
|
64
64
|
export { unary } from './function/unary.mjs';
|
|
65
65
|
export { partial } from './function/partial.mjs';
|
|
66
66
|
export { partialRight } from './function/partialRight.mjs';
|
|
67
|
+
export { rest } from './function/rest.mjs';
|
|
67
68
|
export { clamp } from './math/clamp.mjs';
|
|
68
69
|
export { inRange } from './math/inRange.mjs';
|
|
69
70
|
export { mean } from './math/mean.mjs';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.15.1-dev.
|
|
4
|
+
"version": "1.15.1-dev.446+71a710b7",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|