Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): Promise => {
const value = await acc;
if (typeof preset === 'function') {
const m = await preset();
const result = applyPreset(m, value) as StorybookConfig;
return result;
}
if (typeof preset === 'string') {
const exists = await fs.pathExists(preset);
const m: StorybookConfig | null = exists ? await import(preset) : null;
if (exists && m) {
logger.debug(`applying string-preset: "${preset}"`);
const { presets: mpresets, ...rest } = m;
const newValue = mpresets ? await applyPresets(mpresets, value) : value;
return applyPreset(rest, newValue) as StorybookConfig;
}
logger.warn(`unloadable string-preset: "${preset}"`);
return value;
}
return value;
},
Promise.resolve(base)
mergeWith({}, a, ...rest, (objValue: any, srcValue: any) => {
if (Array.isArray(srcValue) && Array.isArray(objValue)) {
srcValue.forEach(s => {
const existing = objValue.find(o => o === s || isEqual(o, s));
if (!existing) {
objValue.push(s);
}
});
return objValue;
}
if (Array.isArray(objValue)) {
logger.debug('the types mismatch');
return objValue;
}
return undefined;
});
mergeWith({}, a, ...rest, (objValue: any, srcValue: any) => {
if (Array.isArray(srcValue) && Array.isArray(objValue)) {
srcValue.forEach(s => {
const existing = objValue.find(o => o === s || isEqual(o, s));
if (!existing) {
objValue.push(s);
}
});
return objValue;
}
if (Array.isArray(objValue)) {
logger.debug('the types mismatch');
return objValue;
}
return undefined;
});