this repo has no description
1/** @returns {{}} */
2export function get_spread_update(levels, updates) {
3 const update = {};
4 const to_null_out = {};
5 const accounted_for = { $$scope: 1 };
6 let i = levels.length;
7 while (i--) {
8 const o = levels[i];
9 const n = updates[i];
10 if (n) {
11 for (const key in o) {
12 if (!(key in n)) to_null_out[key] = 1;
13 }
14 for (const key in n) {
15 if (!accounted_for[key]) {
16 update[key] = n[key];
17 accounted_for[key] = 1;
18 }
19 }
20 levels[i] = n;
21 } else {
22 for (const key in o) {
23 accounted_for[key] = 1;
24 }
25 }
26 }
27 for (const key in to_null_out) {
28 if (!(key in update)) update[key] = undefined;
29 }
30 return update;
31}
32
33export function get_spread_object(spread_props) {
34 return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
35}