Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Corrected ini parser tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Mar 8, 2011
1 parent 8f414cf commit ba08e20
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -10,12 +10,12 @@ To parse a .ini file async:

To parse a .ini file sync:
var iniparser = require('iniparser');
var config = iniparser.parseSync('./config.ini');
var config = iniparser.parseSync('./config.ini');

## Installation
npm:
npm install iniparser
## License
## License

(The MIT License)

Expand Down
6 changes: 3 additions & 3 deletions lib/node-iniparser.js
Expand Up @@ -11,7 +11,7 @@ var fs = require('fs');
*/
var regex = {
section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
param: /^\s*(\w+)\s*=\s*(.*)\s*$/,
param: /^\s*([\w\.\-\_]+)\s*=\s*(.*)\s*$/,
comment: /^\s*;.*$/
};

Expand All @@ -25,7 +25,7 @@ module.exports.parse = function(file, callback){
if(!callback){
return;
}
fs.readFile(file, 'utf-8', function(err, data){
fs.readFile(file, 'utf8', function(err, data){
if(err){
callback(err);
}else{
Expand All @@ -35,7 +35,7 @@ module.exports.parse = function(file, callback){
};

module.exports.parseSync = function(file){
return parse(fs.readFileSync(file, 'utf-8'));
return parse(fs.readFileSync(file, 'utf8'));
};

function parse(data){
Expand Down
3 changes: 2 additions & 1 deletion test/files/test.ini
@@ -1,6 +1,7 @@
foo=bar
[worlds]
earth=awesome
a.b=c

[section2]
bar=foo
bar=foo

0 comments on commit ba08e20

Please sign in to comment.