|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
601 bytes
|
| Line | |
|---|
| 1 | import { zip } from '../../array/zip.mjs';
|
|---|
| 2 | import { set } from '../object/set.mjs';
|
|---|
| 3 | import { isArrayLike } from '../predicate/isArrayLike.mjs';
|
|---|
| 4 |
|
|---|
| 5 | function zipObjectDeep(keys, values) {
|
|---|
| 6 | const result = {};
|
|---|
| 7 | if (!isArrayLike(keys)) {
|
|---|
| 8 | return result;
|
|---|
| 9 | }
|
|---|
| 10 | if (!isArrayLike(values)) {
|
|---|
| 11 | values = [];
|
|---|
| 12 | }
|
|---|
| 13 | const zipped = zip(Array.from(keys), Array.from(values));
|
|---|
| 14 | for (let i = 0; i < zipped.length; i++) {
|
|---|
| 15 | const [key, value] = zipped[i];
|
|---|
| 16 | if (key != null) {
|
|---|
| 17 | set(result, key, value);
|
|---|
| 18 | }
|
|---|
| 19 | }
|
|---|
| 20 | return result;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | export { zipObjectDeep };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.