1 | import "core-js/modules/es.object.to-string.js";
|
2 | import "core-js/modules/web.dom-collections.for-each.js";
|
3 | import "core-js/modules/es.array.find.js";
|
4 | import mergeWith from 'lodash/mergeWith';
|
5 | import isEqual from 'lodash/isEqual';
|
6 | import { logger } from '@storybook/client-logger';
|
7 | export default (function (a, b) {
|
8 | return mergeWith({}, a, b, function (objValue, srcValue) {
|
9 | if (Array.isArray(srcValue) && Array.isArray(objValue)) {
|
10 | srcValue.forEach(function (s) {
|
11 | var existing = objValue.find(function (o) {
|
12 | return o === s || isEqual(o, s);
|
13 | });
|
14 |
|
15 | if (!existing) {
|
16 | objValue.push(s);
|
17 | }
|
18 | });
|
19 | return objValue;
|
20 | }
|
21 |
|
22 | if (Array.isArray(objValue)) {
|
23 | logger.log(['the types mismatch, picking', objValue]);
|
24 | return objValue;
|
25 | }
|
26 |
|
27 | return undefined;
|
28 | });
|
29 | }); |
\ | No newline at end of file |