Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

require-json5

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-json5 - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

test/.configrc

15

index.js

@@ -5,7 +5,7 @@ /**

* @license MIT
* @version 1.0.2
* @version 1.1.0
* @author Dumitru Uzun (DUzun.Me)
*/
var VERSION = '1.0.2';
var VERSION = '1.1.0';

@@ -19,3 +19,12 @@ var fs = require('fs');

function requireJSON5(filename) {
if ( path.extname(filename) == '' ) filename += fs.existsSync(filename + '.json5') ? '.json5' : '.json';
if ( path.extname(filename) == '' ) {
const extensions = ['.json5', '.json'];
for(var i=0, l = extensions.length, ext; i<l; ++i) {
ext = extensions[i];
if(fs.existsSync(filename + ext)) {
filename += ext;
break;
}
}
}
try {

@@ -22,0 +31,0 @@ return JSON5.parse(stripBOM(fs.readFileSync(filename, 'utf8')));

9

package.json
{
"name": "require-json5",
"version": "1.0.2",
"version": "1.1.0",
"description": "Require JSON5 files in node - a better JSON for ES5 era",

@@ -8,3 +8,3 @@ "main": "index.js",

"test": "node test/",
"verup": "verup"
"verup": "npx verup"
},

@@ -15,2 +15,3 @@ "repository": {

},
"reveal": true,
"keywords": [

@@ -34,3 +35,3 @@ "environment",

],
"author": "Dumitru Uzun <contanct@duzun.me> (https://DUzun.Me)",
"author": "Dumitru Uzun <contact@duzun.me> (https://DUzun.Me)",
"license": "MIT",

@@ -42,3 +43,3 @@ "bugs": {

"dependencies": {
"json5": "^x.x"
"json5": "^2.x"
},

@@ -45,0 +46,0 @@ "devDependencies": {

@@ -19,5 +19,9 @@

// 3.
var config = requireJSON(__dirname + '/.configrc'); // no extension file
asert.equal(config.noext, true);
requireJSON.replace();
// 3.
// 4.
var config = require("./config"); // .json file

@@ -28,3 +32,3 @@ asert.equal(config.name, 'json', 'yes');

// 4.
// 5.
var configStr = fs.readFileSync(__dirname + "/config5.json5", 'utf8');

@@ -31,0 +35,0 @@ var config = requireJSON.parse(configStr);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc