Skip to content

Commit

Permalink
allow single quote json (cause aws removes the double quotes) and rep…
Browse files Browse the repository at this point in the history
…lace them before JSON.parse
  • Loading branch information
bejavu committed Aug 23, 2017
1 parent c4c6a82 commit c78ef86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ module.exports = {
}
}
}
if (options) {
if (options && typeof options === 'string') {
try {
if (!~options.indexOf('"') && ~options.indexOf('\'')) {
options = options.replace(/'/g, '"')
}
options = JSON.parse(options)
options = _.merge(default_options, options)
} catch (e) {
Expand Down

0 comments on commit c78ef86

Please sign in to comment.