UNPKG

844 BJavaScriptView Raw
1import "core-js/modules/es.object.to-string.js";
2import "core-js/modules/web.dom-collections.for-each.js";
3import "core-js/modules/es.array.find.js";
4import mergeWith from 'lodash/mergeWith';
5import isEqual from 'lodash/isEqual';
6import { logger } from '@storybook/client-logger';
7export 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