/ Gists / Configuration options object
On gists

Configuration options object

Popular ⭐ JavaScript Vue.js

options.js Raw #

// JS
function setPreferences({ theme = 'dark', layout = 'grid' } = {}) {
  console.log(`Preferences set: Theme - ${theme}, Layout - ${layout}`);
}

export function useRefHistory(ref, options) {
  const {
    deep = false,
    capacity = Infinity,
  } = options;

  // ...
};

// https://michaelnthiessen.com/tips/options-object
export function useRefHistory(ref, options) {
  const {
    deep = false,
    capacity = Infinity,
    ...otherOptions,
  } = options;

  // Pass along some options we're not using directly
  useSomeOtherComposable(otherOptions);
};