Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destructure options in the function body #7

Merged
merged 2 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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