From 976983960d69cb8aac8327880b0f3c1ef28ff81f Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 10 Mar 2010 00:17:15 -0800 Subject: [PATCH] More ini parser features. Update the ini parser to support some more whitespace cases, turn lines without an equal sign into a "flag" that's just true if set, and support comments. --- lib/ini.js | 17 ++++++++++------- test/fixtures/fixture.ini | 10 +++++++++- test/simple/test-ini.js | 25 ++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/lib/ini.js b/lib/ini.js index 6a1b18daa8..bc1938733b 100644 --- a/lib/ini.js +++ b/lib/ini.js @@ -1,22 +1,25 @@ exports.parse = function(d) { - var trim = function(str) { return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } var ini = {'-':{}}; var section = '-'; var lines = d.split('\n'); for (var i=0; i