es-toolkit 1.13.1-dev.367 → 1.13.1-dev.369
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/_chunk/{size-CJyNw8.js → size-DmGMC-.js} +5 -0
- package/dist/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +2 -1
- package/dist/array/index.mjs +1 -0
- package/dist/array/isSubset.d.mts +26 -0
- package/dist/array/isSubset.d.ts +26 -0
- package/dist/array/isSubset.mjs +7 -0
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +3 -1
- package/dist/compat/index.mjs +2 -0
- package/dist/function/bind.d.mts +32 -0
- package/dist/function/bind.d.ts +32 -0
- package/dist/function/bind.mjs +22 -0
- package/dist/function/index.d.mts +1 -0
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.js +22 -0
- package/dist/function/index.mjs +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.mjs +2 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -40,6 +40,7 @@ export { zipObject } from '../array/zipObject.mjs';
|
|
|
40
40
|
export { zipWith } from '../array/zipWith.mjs';
|
|
41
41
|
export { without } from '../array/without.mjs';
|
|
42
42
|
export { head as first, head } from '../array/head.mjs';
|
|
43
|
+
export { isSubset } from '../array/isSubset.mjs';
|
|
43
44
|
export { tail } from '../array/tail.mjs';
|
|
44
45
|
export { toFilled } from '../array/toFilled.mjs';
|
|
45
46
|
export { last } from '../array/last.mjs';
|
|
@@ -54,6 +55,7 @@ export { noop } from '../function/noop.mjs';
|
|
|
54
55
|
export { once } from '../function/once.mjs';
|
|
55
56
|
export { throttle } from '../function/throttle.mjs';
|
|
56
57
|
export { negate } from '../function/negate.mjs';
|
|
58
|
+
export { bind } from '../function/bind.mjs';
|
|
57
59
|
export { clamp } from '../math/clamp.mjs';
|
|
58
60
|
export { inRange } from '../math/inRange.mjs';
|
|
59
61
|
export { mean } from '../math/mean.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export { zipObject } from '../array/zipObject.js';
|
|
|
40
40
|
export { zipWith } from '../array/zipWith.js';
|
|
41
41
|
export { without } from '../array/without.js';
|
|
42
42
|
export { head as first, head } from '../array/head.js';
|
|
43
|
+
export { isSubset } from '../array/isSubset.js';
|
|
43
44
|
export { tail } from '../array/tail.js';
|
|
44
45
|
export { toFilled } from '../array/toFilled.js';
|
|
45
46
|
export { last } from '../array/last.js';
|
|
@@ -54,6 +55,7 @@ export { noop } from '../function/noop.js';
|
|
|
54
55
|
export { once } from '../function/once.js';
|
|
55
56
|
export { throttle } from '../function/throttle.js';
|
|
56
57
|
export { negate } from '../function/negate.js';
|
|
58
|
+
export { bind } from '../function/bind.js';
|
|
57
59
|
export { clamp } from '../math/clamp.js';
|
|
58
60
|
export { inRange } from '../math/inRange.js';
|
|
59
61
|
export { mean } from '../math/mean.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const size = require('../_chunk/size-
|
|
5
|
+
const size = require('../_chunk/size-DmGMC-.js');
|
|
6
6
|
const isNil = require('../_chunk/isNil-IuJ4cv.js');
|
|
7
7
|
const promise_index = require('../_chunk/index-CwRt_M.js');
|
|
8
8
|
const function_index = require('../function/index.js');
|
|
@@ -423,6 +423,7 @@ exports.initial = size.initial;
|
|
|
423
423
|
exports.intersection = size.intersection;
|
|
424
424
|
exports.intersectionBy = size.intersectionBy;
|
|
425
425
|
exports.intersectionWith = size.intersectionWith;
|
|
426
|
+
exports.isSubset = size.isSubset;
|
|
426
427
|
exports.keyBy = size.keyBy;
|
|
427
428
|
exports.last = size.last;
|
|
428
429
|
exports.maxBy = size.maxBy;
|
|
@@ -461,6 +462,7 @@ exports.delay = promise_index.delay;
|
|
|
461
462
|
exports.withTimeout = promise_index.withTimeout;
|
|
462
463
|
exports.after = function_index.after;
|
|
463
464
|
exports.before = function_index.before;
|
|
465
|
+
exports.bind = function_index.bind;
|
|
464
466
|
exports.debounce = function_index.debounce;
|
|
465
467
|
exports.negate = function_index.negate;
|
|
466
468
|
exports.noop = function_index.noop;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -40,6 +40,7 @@ export { zipObject } from '../array/zipObject.mjs';
|
|
|
40
40
|
export { zipWith } from '../array/zipWith.mjs';
|
|
41
41
|
export { without } from '../array/without.mjs';
|
|
42
42
|
export { head as first, head } from '../array/head.mjs';
|
|
43
|
+
export { isSubset } from '../array/isSubset.mjs';
|
|
43
44
|
export { tail } from '../array/tail.mjs';
|
|
44
45
|
export { toFilled } from '../array/toFilled.mjs';
|
|
45
46
|
export { last } from '../array/last.mjs';
|
|
@@ -54,6 +55,7 @@ export { noop } from '../function/noop.mjs';
|
|
|
54
55
|
export { once } from '../function/once.mjs';
|
|
55
56
|
export { throttle } from '../function/throttle.mjs';
|
|
56
57
|
export { negate } from '../function/negate.mjs';
|
|
58
|
+
export { bind } from '../function/bind.mjs';
|
|
57
59
|
export { clamp } from '../math/clamp.mjs';
|
|
58
60
|
export { inRange } from '../math/inRange.mjs';
|
|
59
61
|
export { mean } from '../math/mean.mjs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives.
|
|
4
|
+
*
|
|
5
|
+
* The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
6
|
+
*
|
|
7
|
+
* **Note:** Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions.
|
|
8
|
+
*
|
|
9
|
+
* @param {(...args: any[]) => any} func The function to bind.
|
|
10
|
+
* @param {any} thisArg The `this` binding of `func`.
|
|
11
|
+
* @param {any[]} partials The arguments to be partially applied.
|
|
12
|
+
* @returns {(...args: any[]) => any} Returns the new bound function.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* function greet(greeting, punctuation) {
|
|
16
|
+
* return greeting + ' ' + this.user + punctuation;
|
|
17
|
+
* }
|
|
18
|
+
* const object = { user: 'fred' };
|
|
19
|
+
* let bound = bind(greet, object, 'hi');
|
|
20
|
+
* bound('!');
|
|
21
|
+
* // => 'hi fred!'
|
|
22
|
+
*
|
|
23
|
+
* bound = bind(greet, object, bind.placeholder, '!');
|
|
24
|
+
* bound('hi');
|
|
25
|
+
* // => 'hi fred!'
|
|
26
|
+
*/
|
|
27
|
+
declare function bind(func: (...args: any[]) => any, thisArg?: any, ...partials: any[]): (...args: any[]) => any;
|
|
28
|
+
declare namespace bind {
|
|
29
|
+
var placeholder: symbol;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { bind };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives.
|
|
4
|
+
*
|
|
5
|
+
* The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
|
|
6
|
+
*
|
|
7
|
+
* **Note:** Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions.
|
|
8
|
+
*
|
|
9
|
+
* @param {(...args: any[]) => any} func The function to bind.
|
|
10
|
+
* @param {any} thisArg The `this` binding of `func`.
|
|
11
|
+
* @param {any[]} partials The arguments to be partially applied.
|
|
12
|
+
* @returns {(...args: any[]) => any} Returns the new bound function.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* function greet(greeting, punctuation) {
|
|
16
|
+
* return greeting + ' ' + this.user + punctuation;
|
|
17
|
+
* }
|
|
18
|
+
* const object = { user: 'fred' };
|
|
19
|
+
* let bound = bind(greet, object, 'hi');
|
|
20
|
+
* bound('!');
|
|
21
|
+
* // => 'hi fred!'
|
|
22
|
+
*
|
|
23
|
+
* bound = bind(greet, object, bind.placeholder, '!');
|
|
24
|
+
* bound('hi');
|
|
25
|
+
* // => 'hi fred!'
|
|
26
|
+
*/
|
|
27
|
+
declare function bind(func: (...args: any[]) => any, thisArg?: any, ...partials: any[]): (...args: any[]) => any;
|
|
28
|
+
declare namespace bind {
|
|
29
|
+
var placeholder: symbol;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { bind };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function bind(func, thisArg, ...partials) {
|
|
2
|
+
const wrapper = function (...args) {
|
|
3
|
+
let index = 0;
|
|
4
|
+
const result = partials.map(bindArg => {
|
|
5
|
+
if (bindArg === bind.placeholder) {
|
|
6
|
+
return args[index++];
|
|
7
|
+
}
|
|
8
|
+
return bindArg;
|
|
9
|
+
});
|
|
10
|
+
for (let i = index; i < args.length; i++) {
|
|
11
|
+
result.push(args[i]);
|
|
12
|
+
}
|
|
13
|
+
if (this instanceof wrapper) {
|
|
14
|
+
return new func(...result);
|
|
15
|
+
}
|
|
16
|
+
return func.apply(thisArg, result);
|
|
17
|
+
};
|
|
18
|
+
return wrapper;
|
|
19
|
+
}
|
|
20
|
+
bind.placeholder = Symbol('bind.placeholder');
|
|
21
|
+
|
|
22
|
+
export { bind };
|
package/dist/function/index.d.ts
CHANGED
package/dist/function/index.js
CHANGED
|
@@ -87,8 +87,30 @@ function negate(func) {
|
|
|
87
87
|
return ((...args) => !func(...args));
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
function bind(func, thisArg, ...partials) {
|
|
91
|
+
const wrapper = function (...args) {
|
|
92
|
+
let index = 0;
|
|
93
|
+
const result = partials.map(bindArg => {
|
|
94
|
+
if (bindArg === bind.placeholder) {
|
|
95
|
+
return args[index++];
|
|
96
|
+
}
|
|
97
|
+
return bindArg;
|
|
98
|
+
});
|
|
99
|
+
for (let i = index; i < args.length; i++) {
|
|
100
|
+
result.push(args[i]);
|
|
101
|
+
}
|
|
102
|
+
if (this instanceof wrapper) {
|
|
103
|
+
return new func(...result);
|
|
104
|
+
}
|
|
105
|
+
return func.apply(thisArg, result);
|
|
106
|
+
};
|
|
107
|
+
return wrapper;
|
|
108
|
+
}
|
|
109
|
+
bind.placeholder = Symbol('bind.placeholder');
|
|
110
|
+
|
|
90
111
|
exports.after = after;
|
|
91
112
|
exports.before = before;
|
|
113
|
+
exports.bind = bind;
|
|
92
114
|
exports.debounce = debounce;
|
|
93
115
|
exports.negate = negate;
|
|
94
116
|
exports.noop = noop;
|
package/dist/function/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -45,6 +45,7 @@ export { zipObject } from './array/zipObject.mjs';
|
|
|
45
45
|
export { zipWith } from './array/zipWith.mjs';
|
|
46
46
|
export { without } from './array/without.mjs';
|
|
47
47
|
export { head } from './array/head.mjs';
|
|
48
|
+
export { isSubset } from './array/isSubset.mjs';
|
|
48
49
|
export { tail } from './array/tail.mjs';
|
|
49
50
|
export { toFilled } from './array/toFilled.mjs';
|
|
50
51
|
export { last } from './array/last.mjs';
|
|
@@ -59,6 +60,7 @@ export { noop } from './function/noop.mjs';
|
|
|
59
60
|
export { once } from './function/once.mjs';
|
|
60
61
|
export { throttle } from './function/throttle.mjs';
|
|
61
62
|
export { negate } from './function/negate.mjs';
|
|
63
|
+
export { bind } from './function/bind.mjs';
|
|
62
64
|
export { clamp } from './math/clamp.mjs';
|
|
63
65
|
export { inRange } from './math/inRange.mjs';
|
|
64
66
|
export { mean } from './math/mean.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { zipObject } from './array/zipObject.js';
|
|
|
45
45
|
export { zipWith } from './array/zipWith.js';
|
|
46
46
|
export { without } from './array/without.js';
|
|
47
47
|
export { head } from './array/head.js';
|
|
48
|
+
export { isSubset } from './array/isSubset.js';
|
|
48
49
|
export { tail } from './array/tail.js';
|
|
49
50
|
export { toFilled } from './array/toFilled.js';
|
|
50
51
|
export { last } from './array/last.js';
|
|
@@ -59,6 +60,7 @@ export { noop } from './function/noop.js';
|
|
|
59
60
|
export { once } from './function/once.js';
|
|
60
61
|
export { throttle } from './function/throttle.js';
|
|
61
62
|
export { negate } from './function/negate.js';
|
|
63
|
+
export { bind } from './function/bind.js';
|
|
62
64
|
export { clamp } from './math/clamp.js';
|
|
63
65
|
export { inRange } from './math/inRange.js';
|
|
64
66
|
export { mean } from './math/mean.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const size = require('./_chunk/size-
|
|
5
|
+
const size = require('./_chunk/size-DmGMC-.js');
|
|
6
6
|
const array_index = require('./array/index.js');
|
|
7
7
|
const isNil = require('./_chunk/isNil-IuJ4cv.js');
|
|
8
8
|
const promise_index = require('./_chunk/index-CwRt_M.js');
|
|
@@ -36,6 +36,7 @@ exports.initial = size.initial;
|
|
|
36
36
|
exports.intersection = size.intersection;
|
|
37
37
|
exports.intersectionBy = size.intersectionBy;
|
|
38
38
|
exports.intersectionWith = size.intersectionWith;
|
|
39
|
+
exports.isSubset = size.isSubset;
|
|
39
40
|
exports.keyBy = size.keyBy;
|
|
40
41
|
exports.last = size.last;
|
|
41
42
|
exports.maxBy = size.maxBy;
|
|
@@ -75,6 +76,7 @@ exports.delay = promise_index.delay;
|
|
|
75
76
|
exports.withTimeout = promise_index.withTimeout;
|
|
76
77
|
exports.after = function_index.after;
|
|
77
78
|
exports.before = function_index.before;
|
|
79
|
+
exports.bind = function_index.bind;
|
|
78
80
|
exports.debounce = function_index.debounce;
|
|
79
81
|
exports.negate = function_index.negate;
|
|
80
82
|
exports.noop = function_index.noop;
|
package/dist/index.mjs
CHANGED
|
@@ -45,6 +45,7 @@ export { zipObject } from './array/zipObject.mjs';
|
|
|
45
45
|
export { zipWith } from './array/zipWith.mjs';
|
|
46
46
|
export { without } from './array/without.mjs';
|
|
47
47
|
export { head } from './array/head.mjs';
|
|
48
|
+
export { isSubset } from './array/isSubset.mjs';
|
|
48
49
|
export { tail } from './array/tail.mjs';
|
|
49
50
|
export { toFilled } from './array/toFilled.mjs';
|
|
50
51
|
export { last } from './array/last.mjs';
|
|
@@ -59,6 +60,7 @@ export { noop } from './function/noop.mjs';
|
|
|
59
60
|
export { once } from './function/once.mjs';
|
|
60
61
|
export { throttle } from './function/throttle.mjs';
|
|
61
62
|
export { negate } from './function/negate.mjs';
|
|
63
|
+
export { bind } from './function/bind.mjs';
|
|
62
64
|
export { clamp } from './math/clamp.mjs';
|
|
63
65
|
export { inRange } from './math/inRange.mjs';
|
|
64
66
|
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.13.1-dev.
|
|
4
|
+
"version": "1.13.1-dev.369+f198dfd9",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|