es-toolkit 1.10.1-dev.230 → 1.10.1-dev.237
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/array/index.d.mts +1 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.js +73 -0
- package/dist/array/index.js.map +1 -1
- package/dist/array/index.mjs +4 -1
- package/dist/chunk-MKCRW4QT.mjs +80 -0
- package/dist/chunk-MKCRW4QT.mjs.map +1 -0
- package/dist/compat/index.d.mts +31 -1
- package/dist/compat/index.d.ts +31 -1
- package/dist/compat/index.js +75 -0
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/index.mjs +6 -1
- package/dist/compat/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/zipObjectDeep-eeZxUsAU.d.mts +37 -0
- package/dist/zipObjectDeep-eeZxUsAU.d.ts +37 -0
- package/package.json +1 -1
- package/dist/chunk-DDH7K4QM.mjs +0 -1
- package/dist/chunk-DDH7K4QM.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -83,7 +83,9 @@ import {
|
|
|
83
83
|
import {
|
|
84
84
|
inRange
|
|
85
85
|
} from "./chunk-BH6HLGBA.mjs";
|
|
86
|
-
import
|
|
86
|
+
import {
|
|
87
|
+
zipObjectDeep
|
|
88
|
+
} from "./chunk-MKCRW4QT.mjs";
|
|
87
89
|
import {
|
|
88
90
|
xor
|
|
89
91
|
} from "./chunk-L7FQX5MN.mjs";
|
|
@@ -349,6 +351,7 @@ export {
|
|
|
349
351
|
xorWith,
|
|
350
352
|
zip,
|
|
351
353
|
zipObject,
|
|
354
|
+
zipObjectDeep,
|
|
352
355
|
zipWith
|
|
353
356
|
};
|
|
354
357
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deeply nested object given arrays of paths and values.
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
|
5
|
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
|
6
|
+
* Paths can be dot-separated strings or arrays of property names.
|
|
7
|
+
*
|
|
8
|
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
|
9
|
+
*
|
|
10
|
+
* @template V - The type of elements in the array.
|
|
11
|
+
* @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
|
12
|
+
* @param {V[]} values - An array of values corresponding to the property paths.
|
|
13
|
+
* @returns {object} A new object composed of the given property paths and values.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const paths = ['a.b.c', 'd.e.f'];
|
|
17
|
+
* const values = [1, 2];
|
|
18
|
+
* const result = zipObjectDeep(paths, values);
|
|
19
|
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
|
23
|
+
* const values = [1, 2];
|
|
24
|
+
* const result = zipObjectDeep(paths, values);
|
|
25
|
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
|
29
|
+
* const values = [1, 2];
|
|
30
|
+
* const result = zipObjectDeep(paths, values);
|
|
31
|
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
|
32
|
+
*/
|
|
33
|
+
declare function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): {
|
|
34
|
+
[K in P]: V;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { zipObjectDeep as z };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deeply nested object given arrays of paths and values.
|
|
3
|
+
*
|
|
4
|
+
* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.
|
|
5
|
+
* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.
|
|
6
|
+
* Paths can be dot-separated strings or arrays of property names.
|
|
7
|
+
*
|
|
8
|
+
* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.
|
|
9
|
+
*
|
|
10
|
+
* @template V - The type of elements in the array.
|
|
11
|
+
* @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.
|
|
12
|
+
* @param {V[]} values - An array of values corresponding to the property paths.
|
|
13
|
+
* @returns {object} A new object composed of the given property paths and values.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const paths = ['a.b.c', 'd.e.f'];
|
|
17
|
+
* const values = [1, 2];
|
|
18
|
+
* const result = zipObjectDeep(paths, values);
|
|
19
|
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];
|
|
23
|
+
* const values = [1, 2];
|
|
24
|
+
* const result = zipObjectDeep(paths, values);
|
|
25
|
+
* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const paths = ['a.b[0].c', 'a.b[1].d'];
|
|
29
|
+
* const values = [1, 2];
|
|
30
|
+
* const result = zipObjectDeep(paths, values);
|
|
31
|
+
* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
|
32
|
+
*/
|
|
33
|
+
declare function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): {
|
|
34
|
+
[K in P]: V;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { zipObjectDeep as z };
|
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.10.1-dev.
|
|
4
|
+
"version": "1.10.1-dev.237+ff4b97ab",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|
package/dist/chunk-DDH7K4QM.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-DDH7K4QM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|