require-json5
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,7 +5,7 @@ /** | ||
* @license MIT | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
* @author Dumitru Uzun (DUzun.Me) | ||
*/ | ||
var VERSION = '1.0.0'; | ||
var VERSION = '1.0.1'; | ||
@@ -19,3 +19,3 @@ var fs = require('fs'); | ||
function requireJSON5(filename) { | ||
if ( path.extname(filename) == '' ) filename += fs.existsSync(filename + '.json5') ? '.json5' : 'json'; | ||
if ( path.extname(filename) == '' ) filename += fs.existsSync(filename + '.json5') ? '.json5' : '.json'; | ||
try { | ||
@@ -22,0 +22,0 @@ return JSON5.parse(stripBOM(fs.readFileSync(filename, 'utf8'))); |
{ | ||
"name": "require-json5", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Require JSON5 files in node - a better JSON for ES5 era", | ||
@@ -25,7 +25,7 @@ "main": "index.js", | ||
"comments", | ||
"trim", | ||
"delete", | ||
"remove", | ||
"strip", | ||
"trailing", | ||
"commas", | ||
"json", | ||
"json5", | ||
"es5", | ||
"require" | ||
@@ -32,0 +32,0 @@ ], |
@@ -8,3 +8,3 @@ | ||
// 1. | ||
var config = requireJSON(__dirname + "/config.json5"); | ||
var config = requireJSON(__dirname + "/config5"); // .json5 file | ||
asert.equal(config.name, 'json5', 'yes'); | ||
@@ -15,3 +15,3 @@ asert.equal(config.unicorn, 'cake'); | ||
// 2. | ||
var config = require('./config.json5'); | ||
var config = require('./config5'); // .json5 file | ||
asert.equal(config.name, 'json5', 'yes'); | ||
@@ -24,3 +24,3 @@ asert.equal(config.unicorn, 'cake'); | ||
// 3. | ||
var config = require("./config"); | ||
var config = require("./config"); // .json file | ||
asert.equal(config.name, 'json', 'yes'); | ||
@@ -31,3 +31,3 @@ asert.equal(config.unicorn, 'cake'); | ||
// 4. | ||
var configStr = fs.readFileSync(__dirname + "/config.json5", 'utf8'); | ||
var configStr = fs.readFileSync(__dirname + "/config5.json5", 'utf8'); | ||
var config = requireJSON.parse(configStr); | ||
@@ -34,0 +34,0 @@ asert.equal(config['one-line'], 'comment 1'); |
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
7171