Skip to content

Commit

Permalink
Destructure options in the function body (#7)
Browse files Browse the repository at this point in the history
* Do the destructuring in the function body instead of the parameter

* 0.3.1
  • Loading branch information
liangyuanruo authored Mar 30, 2020
1 parent 026376d commit 662bd33
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ const crypto = require('./src/crypto')
* the SDK for the FormSG staging environment
* @param {string} [options.webhookSecretKey] Optional base64 secret key for signing webhooks
*/
module.exports = function ({
mode='production',
webhookSecretKey,
} = {}) {
return {
webhooks: webhooks({ mode, webhookSecretKey }),
crypto,
}
module.exports = function (options) {
const {
mode = 'production',
webhookSecretKey,
} = options || {}

return {
webhooks: webhooks({
mode,
webhookSecretKey
}),
crypto,
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opengovsg/formsg-sdk",
"version": "0.3.0",
"version": "0.3.1",
"description": "Node.js SDK for integrating with FormSG",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 662bd33

Please sign in to comment.