-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add hjson support
- Loading branch information
Showing
12 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const hjson = require('hjson'); | ||
|
||
exports.load = function (name) { | ||
return hjson.parse(fs.readFileSync(name, "utf8")); | ||
}; | ||
|
||
exports.empty = function () { | ||
return {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
# specify smtp greeting (because comments are helpful!) | ||
"!smtpgreeting": | ||
[ | ||
# yes, commas are optional! | ||
"this is line one for hjson" | ||
"this is line two for hjson" | ||
] | ||
// prefer c-style comments? | ||
/* feeling old fashioned? */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
matt: "waz here - hjson type" | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
hasDifferent: | ||
value: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
// sign matt (because comments are helpful!) | ||
"matt": "waz here and also made comments", | ||
|
||
// fill in this array | ||
"differentArray": [ | ||
"has element #1", | ||
'has element #2' | ||
] | ||
# best of all | ||
# yes, commas are optional! | ||
|
||
/* feeling old fashioned? */ | ||
"object": { | ||
// prefer c-style comments? | ||
"has a property one": 'with a value A', | ||
'has a property two': with a value B | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const _set_up = function (done) { | ||
this.hjson = require('../../readers/hjson'); | ||
done(); | ||
}; | ||
|
||
exports.load = { | ||
setUp : _set_up, | ||
'module is required' : function (test) { | ||
test.expect(1); | ||
test.ok(this.hjson); | ||
test.done(); | ||
}, | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
test.ok(typeof this.hjson.load === 'function'); | ||
test.done(); | ||
}, | ||
'loads the test HJSON file': function (test) { | ||
test.expect(4); | ||
const result = this.hjson.load('test/config/test.hjson'); | ||
// console.log(result); | ||
test.equal(result.matt, 'waz here and also made comments'); | ||
test.ok(result.differentArray.length); | ||
test.ok(result.object['has a property one']); | ||
test.ok(result.object['has a property two']); | ||
test.done(); | ||
}, | ||
}; |