Skip to content

Instantly share code, notes, and snippets.

@DoctorDerek
Created September 8, 2022 15:36
Show Gist options
  • Save DoctorDerek/750f8d9079a156bc875380069f39d360 to your computer and use it in GitHub Desktop.
Save DoctorDerek/750f8d9079a156bc875380069f39d360 to your computer and use it in GitHub Desktop.
Why You Should Always Pass Objects as Function Parameters in JavaScript https://medium.com/p/7fb7c5833dc6
// @/utils/getChartOptionsObj.js
export default function getChartOptionsObj({
chartData,
maximum,
limitOne,
limitTwo,
percent,
extraOptions,
}) {
const defaultChart = getDefaultChartObj({
chartData,
maximum,
limitOne,
limitTwo,
percent,
})
if (!extraOptions) return defaultChart
return { ...defaultChart, ...extraOptions }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment