es-toolkit 1.34.1-dev.1083 → 1.34.1-dev.1091
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/index.d.mts +1 -0
- package/dist/compat/index.d.ts +1 -0
- package/dist/compat/index.js +8 -0
- package/dist/compat/index.mjs +1 -0
- package/dist/compat/object/create.d.mts +4 -1
- package/dist/compat/object/create.d.ts +4 -1
- package/dist/compat/util/over.d.mts +56 -0
- package/dist/compat/util/over.d.ts +56 -0
- package/dist/compat/util/over.mjs +10 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -270,6 +270,7 @@ export { lte } from './util/lte.mjs';
|
|
|
270
270
|
export { method } from './util/method.mjs';
|
|
271
271
|
export { methodOf } from './util/methodOf.mjs';
|
|
272
272
|
export { now } from './util/now.mjs';
|
|
273
|
+
export { over } from './util/over.mjs';
|
|
273
274
|
export { stubArray } from './util/stubArray.mjs';
|
|
274
275
|
export { stubFalse } from './util/stubFalse.mjs';
|
|
275
276
|
export { stubObject } from './util/stubObject.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -270,6 +270,7 @@ export { lte } from './util/lte.js';
|
|
|
270
270
|
export { method } from './util/method.js';
|
|
271
271
|
export { methodOf } from './util/methodOf.js';
|
|
272
272
|
export { now } from './util/now.js';
|
|
273
|
+
export { over } from './util/over.js';
|
|
273
274
|
export { stubArray } from './util/stubArray.js';
|
|
274
275
|
export { stubFalse } from './util/stubFalse.js';
|
|
275
276
|
export { stubObject } from './util/stubObject.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -3357,6 +3357,13 @@ function now() {
|
|
|
3357
3357
|
return Date.now();
|
|
3358
3358
|
}
|
|
3359
3359
|
|
|
3360
|
+
function over(iteratees) {
|
|
3361
|
+
const funcs = iteratees.map(item => iteratee(item));
|
|
3362
|
+
return function (...args) {
|
|
3363
|
+
return funcs.map(func => func.apply(this, args));
|
|
3364
|
+
};
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3360
3367
|
function stubArray() {
|
|
3361
3368
|
return [];
|
|
3362
3369
|
}
|
|
@@ -3646,6 +3653,7 @@ exports.nth = nth;
|
|
|
3646
3653
|
exports.nthArg = nthArg;
|
|
3647
3654
|
exports.omit = omit;
|
|
3648
3655
|
exports.orderBy = orderBy;
|
|
3656
|
+
exports.over = over;
|
|
3649
3657
|
exports.pad = pad;
|
|
3650
3658
|
exports.padEnd = padEnd;
|
|
3651
3659
|
exports.padStart = padStart;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -270,6 +270,7 @@ export { lte } from './util/lte.mjs';
|
|
|
270
270
|
export { method } from './util/method.mjs';
|
|
271
271
|
export { methodOf } from './util/methodOf.mjs';
|
|
272
272
|
export { now } from './util/now.mjs';
|
|
273
|
+
export { over } from './util/over.mjs';
|
|
273
274
|
export { stubArray } from './util/stubArray.mjs';
|
|
274
275
|
export { stubFalse } from './util/stubFalse.mjs';
|
|
275
276
|
export { stubObject } from './util/stubObject.mjs';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates an object that inherits from the prototype object.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* If `properties` are provided, they will be added to the new object.
|
|
5
|
+
* Only string-keyed enumerable properties directly owned by the `properties` object are copied.
|
|
6
|
+
* Inherited properties or those with `Symbol` keys are not copied.
|
|
4
7
|
*
|
|
5
8
|
* @template T - The prototype object type.
|
|
6
9
|
* @template U - The properties object type.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates an object that inherits from the prototype object.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* If `properties` are provided, they will be added to the new object.
|
|
5
|
+
* Only string-keyed enumerable properties directly owned by the `properties` object are copied.
|
|
6
|
+
* Inherited properties or those with `Symbol` keys are not copied.
|
|
4
7
|
*
|
|
5
8
|
* @template T - The prototype object type.
|
|
6
9
|
* @template U - The properties object type.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that invokes the provided function iteratees with the arguments it receives
|
|
3
|
+
* and returns an array of the results.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of arguments the created function will receive
|
|
6
|
+
* @template R - The return type of the iteratee functions
|
|
7
|
+
* @param {Array<((...args: T) => R)>} iteratees - The functions to invoke
|
|
8
|
+
* @returns {Function} Returns the new function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const func = over([Math.max, Math.min]);
|
|
12
|
+
* func(1, 2, 3, 4);
|
|
13
|
+
* // => [4, 1]
|
|
14
|
+
*/
|
|
15
|
+
declare function over<T extends unknown[], R>(iteratees: Array<(...args: T) => R>): (...args: T) => R[];
|
|
16
|
+
/**
|
|
17
|
+
* Returns a function that checks if an object's properties match the given key-value pairs.
|
|
18
|
+
*
|
|
19
|
+
* @template T - The type of arguments the created function will receive
|
|
20
|
+
* @param {Array<[PropertyKey, unknown]>} iteratees - The key-value pairs to match
|
|
21
|
+
* @returns {Function} Returns the new function.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const func = over([['a', 1], ['b', 2]]);
|
|
25
|
+
* func({ a: 1, b: 2 });
|
|
26
|
+
* // => [true, true]
|
|
27
|
+
*/
|
|
28
|
+
declare function over<T extends [object]>(iteratees: Array<[PropertyKey, unknown]>): (...args: T) => boolean[];
|
|
29
|
+
/**
|
|
30
|
+
* Returns a function that checks if an object matches the given source objects.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type of arguments the created function will receive
|
|
33
|
+
* @param {Array<object>} iteratees - The source objects to match
|
|
34
|
+
* @returns {Function} Returns the new function.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const func = over([{ a: 1 }, { b: 2 }]);
|
|
38
|
+
* func({ a: 1, b: 2 });
|
|
39
|
+
* // => [true, false]
|
|
40
|
+
*/
|
|
41
|
+
declare function over<T extends [object]>(iteratees: object[]): (...args: T) => boolean[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns a function that returns property values at the given paths for an object.
|
|
44
|
+
*
|
|
45
|
+
* @template T - The type of arguments the created function will receive
|
|
46
|
+
* @param {PropertyKey[]} iteratees - The property paths to get
|
|
47
|
+
* @returns {Function} Returns the new function.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const func = over(['a', 'b']);
|
|
51
|
+
* func({ a: 1, b: 2 });
|
|
52
|
+
* // => [1, 2]
|
|
53
|
+
*/
|
|
54
|
+
declare function over<T extends [object]>(iteratees: PropertyKey[]): (...args: T) => unknown[];
|
|
55
|
+
|
|
56
|
+
export { over };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that invokes the provided function iteratees with the arguments it receives
|
|
3
|
+
* and returns an array of the results.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of arguments the created function will receive
|
|
6
|
+
* @template R - The return type of the iteratee functions
|
|
7
|
+
* @param {Array<((...args: T) => R)>} iteratees - The functions to invoke
|
|
8
|
+
* @returns {Function} Returns the new function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const func = over([Math.max, Math.min]);
|
|
12
|
+
* func(1, 2, 3, 4);
|
|
13
|
+
* // => [4, 1]
|
|
14
|
+
*/
|
|
15
|
+
declare function over<T extends unknown[], R>(iteratees: Array<(...args: T) => R>): (...args: T) => R[];
|
|
16
|
+
/**
|
|
17
|
+
* Returns a function that checks if an object's properties match the given key-value pairs.
|
|
18
|
+
*
|
|
19
|
+
* @template T - The type of arguments the created function will receive
|
|
20
|
+
* @param {Array<[PropertyKey, unknown]>} iteratees - The key-value pairs to match
|
|
21
|
+
* @returns {Function} Returns the new function.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const func = over([['a', 1], ['b', 2]]);
|
|
25
|
+
* func({ a: 1, b: 2 });
|
|
26
|
+
* // => [true, true]
|
|
27
|
+
*/
|
|
28
|
+
declare function over<T extends [object]>(iteratees: Array<[PropertyKey, unknown]>): (...args: T) => boolean[];
|
|
29
|
+
/**
|
|
30
|
+
* Returns a function that checks if an object matches the given source objects.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type of arguments the created function will receive
|
|
33
|
+
* @param {Array<object>} iteratees - The source objects to match
|
|
34
|
+
* @returns {Function} Returns the new function.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const func = over([{ a: 1 }, { b: 2 }]);
|
|
38
|
+
* func({ a: 1, b: 2 });
|
|
39
|
+
* // => [true, false]
|
|
40
|
+
*/
|
|
41
|
+
declare function over<T extends [object]>(iteratees: object[]): (...args: T) => boolean[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns a function that returns property values at the given paths for an object.
|
|
44
|
+
*
|
|
45
|
+
* @template T - The type of arguments the created function will receive
|
|
46
|
+
* @param {PropertyKey[]} iteratees - The property paths to get
|
|
47
|
+
* @returns {Function} Returns the new function.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const func = over(['a', 'b']);
|
|
51
|
+
* func({ a: 1, b: 2 });
|
|
52
|
+
* // => [1, 2]
|
|
53
|
+
*/
|
|
54
|
+
declare function over<T extends [object]>(iteratees: PropertyKey[]): (...args: T) => unknown[];
|
|
55
|
+
|
|
56
|
+
export { over };
|
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.34.1-dev.
|
|
4
|
+
"version": "1.34.1-dev.1091+541fd64c",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|