From ae75877e8e33ba40362502602d2e1c68e1c7b4e6 Mon Sep 17 00:00:00 2001 From: Bevan Collins Date: Fri, 14 Feb 2014 14:32:41 +1300 Subject: [PATCH 1/3] don't treat numeric properties as string --- lib/Ini.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Ini.js b/lib/Ini.js index fa3bbf0..f60a31d 100644 --- a/lib/Ini.js +++ b/lib/Ini.js @@ -270,9 +270,12 @@ } else if (this.value === true) { return this.name + ' = yes'; } else { - var val = this.value.replace(/\n/g, '\\\n'); - if (-1 !== val.indexOf('#') || -1 !== val.indexOf(';')) { - return this.name + ' = "' + val.replace(/"/g, '\\"') + '"'; + var val = this.value; + if (isNaN(val)) { + var val = val.replace(/\n/g, '\\\n'); + if (-1 !== val.indexOf('#') || -1 !== val.indexOf(';')) { + return this.name + ' = "' + val.replace(/"/g, '\\"') + '"'; + } } return this.name + ' = ' + val; } From 6d4378854dcfb71bfe9a66b917ecf63302eb7264 Mon Sep 17 00:00:00 2001 From: Bevan Collins Date: Fri, 14 Feb 2014 14:35:53 +1300 Subject: [PATCH 2/3] don't treat numeric properties as string --- lib/Ini.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Ini.js b/lib/Ini.js index f60a31d..456f0ce 100644 --- a/lib/Ini.js +++ b/lib/Ini.js @@ -272,7 +272,7 @@ } else { var val = this.value; if (isNaN(val)) { - var val = val.replace(/\n/g, '\\\n'); + val = val.replace(/\n/g, '\\\n'); if (-1 !== val.indexOf('#') || -1 !== val.indexOf(';')) { return this.name + ' = "' + val.replace(/"/g, '\\"') + '"'; } From 49b5f2e1774fc0f100e4248bcb04c6d45835a8e1 Mon Sep 17 00:00:00 2001 From: Bevan Collins Date: Wed, 26 Feb 2014 22:46:58 +1300 Subject: [PATCH 3/3] limit variable scope --- lib/Ini.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Ini.js b/lib/Ini.js index 456f0ce..837e5e2 100644 --- a/lib/Ini.js +++ b/lib/Ini.js @@ -225,7 +225,7 @@ }; Ini.Section.prototype.toString = function(){ - var s = ''; + var i, s = ''; for (i=0; i