Created
January 9, 2019 14:04
-
-
Save PCreations/f4a01ee6b4f361b788b189ad0dc585c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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