From 5c78c45fa3cb1ad91ec96eef6302e7f1c4b762af Mon Sep 17 00:00:00 2001 From: Rob Ellis Date: Fri, 5 Mar 2010 16:12:31 -0800 Subject: [PATCH] Added Parse INI to Node, tests --- lib/ini.js | 26 ++++++++++++++++++++++++++ test/fixtures/fixture.ini | 11 +++++++++++ test/simple/test-ini.js | 22 ++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 lib/ini.js create mode 100644 test/fixtures/fixture.ini create mode 100644 test/simple/test-ini.js diff --git a/lib/ini.js b/lib/ini.js new file mode 100644 index 0000000000..6a1b18daa8 --- /dev/null +++ b/lib/ini.js @@ -0,0 +1,26 @@ +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