@modern-js/utils
Version:
A Progressive React Framework for modern web development.
15 lines (14 loc) • 782 B
JavaScript
import { isPlainObject } from "../is/index.mjs";
const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName)=>{
if (!optionsByEntries) return baseOptions;
{
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
if (void 0 === optionsByEntry && isMainEntry && packageName) optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
return void 0 !== optionsByEntry ? isPlainObject(optionsByEntry) && isPlainObject(baseOptions) ? {
...baseOptions,
...optionsByEntry
} : optionsByEntry : baseOptions;
}
};
const getOptionsByEntryName = (name, optionsByEntries)=>optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
export { getEntryOptions };