From 1108114b71baa872e1100ccb2c158e2c8771f728 Mon Sep 17 00:00:00 2001 From: Denis Izmaylov Date: Thu, 10 Oct 2013 19:47:20 +0400 Subject: [PATCH] added pre-parsing to remove JS-like comments from JSON With this feature we can add comments to our config files --- src/json.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/json.js b/src/json.js index d5c2c34..13edda0 100644 --- a/src/json.js +++ b/src/json.js @@ -4,6 +4,9 @@ * Author: Miller Medeiros * Version: 0.3.2 (2013/08/17) * Released under the MIT license + * + * Patched (2013/10/10): + * - supports JS-like comments which are beginning from /* or // */ define(['text'], function(text){ @@ -29,6 +32,7 @@ define(['text'], function(text){ onLoad(null); } else { text.get(req.toUrl(name), function(data){ + data = data.replace(/\/\*.+?\*\/|\/\/.*(?=[\n\r])/g, ''); if (config.isBuild) { buildMap[name] = data; onLoad(data);