From 0b41bd5532cc08ae98de3a7c4fc41d4506453805 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 18 Oct 2018 10:15:12 +0200 Subject: [PATCH] resolve-props: better heuristic (take all possible 1st char into account) --- src/browser/js/app/widgets/common/widget.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/browser/js/app/widgets/common/widget.js b/src/browser/js/app/widgets/common/widget.js index 4a3b0691..ef5b1dc6 100644 --- a/src/browser/js/app/widgets/common/widget.js +++ b/src/browser/js/app/widgets/common/widget.js @@ -490,8 +490,10 @@ class Widget extends EventEmitter { } // heuristic to avoid using JSON when unnecessary - // if the string starts with one of these chars it's going to fail - if ('/@#.'.indexOf(propValue[0]) === -1) { + // if the string doesn't starts with one of these chars + // it's going to fail + // ref in source: https://github.com/douglascrockford/JSON-js + if (' +-eE{([0123456789tfn"'.indexOf(propValue[0]) !== -1) { try { propValue = JSON.parse(propValue) } catch (err) {}