import { isPlainObject } from './is' ; import { MAIN_ENTRY_NAME } from './constants' ; export const getEntryOptions = < T > ( name , baseOptions ? , optionsByEntries ? , packageName ? ) => { if ( optionsByEntries ) { let optionsByEntry = getOptionsByEntryName ( name , optionsByEntries ) ; if ( optionsByEntry === undefined && name === MAIN_ENTRY_NAME && packageName ) { optionsByEntry = getOptionsByEntryName ( packageName , optionsByEntries ) ; } return optionsByEntry !== undefined ? isPlainObject ( optionsByEntry ) && isPlainObject ( baseOptions ) ? { ... baseOptions , ... optionsByEntry } : optionsByEntry : baseOptions ; } else { return baseOptions ; } } ; const getOptionsByEntryName = < T > ( name , optionsByEntries ) => optionsByEntries . hasOwnProperty ( name ) ? optionsByEntries [ name ] : undefined ;