Skip to content

Instantly share code, notes, and snippets.

@jsatk
Created January 17, 2018 18:19
Show Gist options
  • Save jsatk/670438bc762f7960e3b3568e6f32c582 to your computer and use it in GitHub Desktop.
Save jsatk/670438bc762f7960e3b3568e6f32c582 to your computer and use it in GitHub Desktop.
const config = Object.freeze({
async: true,
page: 4
});
const getThing = config => {
const awesomeFunction = options => {
const updatedOptions = Object.assign({}, options, {
offset: options.offset || 10
});
// do stuff with updatedOptions
};
return Object.freeze({
...config,
awesomeFunction,
amount: config.amount * 100
});
};
const thing = getThing(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment