From c78ef8656d5e84c27ac07c88dc77c606b3f7469a Mon Sep 17 00:00:00 2001 From: Tal Beja Date: Wed, 23 Aug 2017 13:48:01 +0300 Subject: [PATCH] allow single quote json (cause aws removes the double quotes) and replace them before JSON.parse --- lib/db.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/db.js b/lib/db.js index 800404a..55cbad4 100644 --- a/lib/db.js +++ b/lib/db.js @@ -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) {