Skip to content

Instantly share code, notes, and snippets.

@PCreations
Created January 9, 2019 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PCreations/f4a01ee6b4f361b788b189ad0dc585c7 to your computer and use it in GitHub Desktop.
Save PCreations/f4a01ee6b4f361b788b189ad0dc585c7 to your computer and use it in GitHub Desktop.
const { FooData } = require('./data');
const updateBar = ({ fooData, bar }) => {
if (typeof bar !== typeof '') {
throw new Error('bar should be a valid string');
}
return FooData({
...fooData,
bar,
foobaz: bar.indexOf('?') === -1 ? fooData.foobaz : 42,
});
}
module.exports = {
updateBar,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment