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

read-json-sync

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-json-sync - npm Package Compare versions

Comparing version 2.0.0-0 to 2.0.0-1

12

index.js

@@ -5,4 +5,12 @@ 'use strict';

module.exports = function readJsonSync(filePath, options) {
return JSON.parse(readFileSync(filePath, options).toString().replace(/^\ufeff/g, ''));
module.exports = function readJsonSync(...args) {
const argLen = args.length;
if (argLen !== 1 && argLen !== 2) {
throw new RangeError(`Expected 1 or 2 arguments (path[, options]), but got ${
argLen === 0 ? 'no' : argLen
} arguments.`);
}
return JSON.parse(readFileSync(...args).toString().replace(/^\ufeff/g, ''));
};

8

package.json
{
"name": "read-json-sync",
"version": "2.0.0-0",
"version": "2.0.0-1",
"description": "Read and parse a JSON file synchronously",

@@ -9,4 +9,3 @@ "repository": "shinnn/read-json-sync",

"pretest": "eslint --fix --format=codeframe index.js test/test.js",
"test": "node --throw-deprecation --track-heap-objects test/test.js | tap-spec",
"coverage": "istanbul cover test/test.js"
"test": "istanbul cover test/test.js"
},

@@ -33,5 +32,4 @@ "license": "CC0-1.0",

"@shinnn/eslint-config-node": "^4.0.2",
"eslint": "^4.4.1",
"eslint": "^4.6.1",
"istanbul": "^0.4.5",
"tap-spec": "^4.1.1",
"tape": "^4.8.0"

@@ -38,0 +36,0 @@ },

# read-json-sync
[![NPM version](https://img.shields.io/npm/v/read-json-sync.svg)](https://www.npmjs.com/package/read-json-sync)
[![npm version](https://img.shields.io/npm/v/read-json-sync.svg)](https://www.npmjs.com/package/read-json-sync)
[![Build Status](https://travis-ci.org/shinnn/read-json-sync.svg?branch=master)](https://travis-ci.org/shinnn/read-json-sync)
[![Build status](https://ci.appveyor.com/api/projects/status/t7sjgpku9on12d32?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/read-json-sync)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/read-json-sync.svg)](https://david-dm.org/shinnn/read-json-sync)

@@ -32,7 +31,7 @@

### readJsonSync(*filePath* [, *options*])
### readJsonSync(*path* [, *options*])
*filePath*: `String` (path to a JSON file)
*options*: `Object` ([`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_filename_options_callback) options)
Return: `Object` (parsed [JSON](https://tools.ietf.org/html/rfc7159) data)
*path*: `string` [`Buffer`](https://nodejs.org/api/buffer.html#buffer_class_buffer) [`URL`](https://nodejs.org/api/url.html#url_class_url) (JSON filename) or `integer` (file descriptor)
*options*: `Object` ([`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options)
Return: `any` (parsed [JSON](https://tools.ietf.org/html/rfc7159) data)

@@ -39,0 +38,0 @@ ## License

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