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.0 to 1.0.1

test/config5.json5

6

index.js

@@ -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');

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