Comparing version 0.1.0 to 0.1.1
@@ -43,2 +43,7 @@ /** | ||
//if first index in array is empty string, strip it off (happens when first line of file is comment. Breaks the parsing) | ||
if (tokens[0] === "") { | ||
tokens.shift(); | ||
} | ||
for(var i = 0; i < tokens.length; i+=2) { | ||
@@ -45,0 +50,0 @@ var key = tokens[i] |
{ | ||
"name": "netrc", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Parse netrc files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,4 @@ /** | ||
var valid = fs.readFileSync(__dirname+"/fixtures/netrc-valid", "utf-8") | ||
, invalid = fs.readFileSync(__dirname+"/fixtures/netrc-invalid", "utf-8"); | ||
, invalid = fs.readFileSync(__dirname+"/fixtures/netrc-invalid", "utf-8") | ||
, validWithComment = fs.readFileSync(__dirname+"/fixtures/netrc-valid-w-comment", "utf-8"); | ||
@@ -25,2 +26,12 @@ describe("netrc", function() { | ||
it("should parse a valid file with comments", function() { | ||
var machines = netrc(__dirname+"/fixtures/netrc-valid-w-comment"); | ||
should.exist(machines); | ||
machines.should.have.property("github.com"); | ||
machines["github.com"].should.have.property("login"); | ||
machines["github.com"].login.should.eql("CamShaft"); | ||
machines["github.com"].should.have.property("password"); | ||
machines["github.com"].password.should.eql("123"); | ||
}); | ||
it("should not parse an invalid string", function() { | ||
@@ -44,2 +55,12 @@ var machines = netrc(__dirname+"/fixtures/netrc-invalid"); | ||
it("should parse a valid string (pulled from file with comments)", function() { | ||
var machines = netrc.parse(validWithComment); | ||
should.exist(machines); | ||
machines.should.have.property("github.com"); | ||
machines["github.com"].should.have.property("login"); | ||
machines["github.com"].login.should.eql("CamShaft"); | ||
machines["github.com"].should.have.property("password"); | ||
machines["github.com"].password.should.eql("123"); | ||
}); | ||
it("should not parse an invalid string", function() { | ||
@@ -46,0 +67,0 @@ var machines = netrc.parse(invalid); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4878
9
119