read-json-sync
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,10 +7,6 @@ /*! | ||
var fs = require('fs'); | ||
var fs = require('graceful-fs'); | ||
var bomRegex = /^\ufeff/g; | ||
module.exports = function readJsonSync(filePath, options) { | ||
options = options || {}; | ||
var buf = fs.readFileSync(filePath, options); | ||
return JSON.parse(buf.toString().replace(bomRegex, '')); | ||
return JSON.parse(String(fs.readFileSync(filePath, options)).replace(/^\ufeff/g, '')); | ||
}; |
{ | ||
"name": "read-json-sync", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Read and parse a JSON file synchronously", | ||
@@ -11,5 +11,5 @@ "repository": "shinnn/read-json-sync", | ||
"scripts": { | ||
"pretest": "eslint *.js & jscs *.js", | ||
"test": "node test.js | tap-spec", | ||
"coverage": "istanbul cover test.js", | ||
"pretest": "jscs index.js test/*.js && eslint index.js test/*.js", | ||
"test": "node test/test.js | tap-spec", | ||
"coverage": "istanbul cover test/test.js", | ||
"coveralls": "${npm_package_scripts_coverage} && istanbul-coveralls" | ||
@@ -24,9 +24,8 @@ }, | ||
"files": [ | ||
"index.js", | ||
"LICENSE" | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"json", | ||
"virtual", | ||
"file", | ||
"read", | ||
"parse", | ||
@@ -36,11 +35,19 @@ "synchronous", | ||
], | ||
"dependencies": { | ||
"graceful-fs": "^3.0.5" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^0.8.2", | ||
"istanbul": "^0.3.2", | ||
"istanbul-coveralls": "^1.0.0", | ||
"jscs": "^1.6.2", | ||
"require-main": "^0.1.1", | ||
"tap-spec": "^1.0.0", | ||
"tape": "^3.0.0" | ||
"eslint": "^0.14.1", | ||
"istanbul": "^0.3.6", | ||
"istanbul-coveralls": "^1.0.1", | ||
"jscs": "^1.11.3", | ||
"tap-spec": "^2.2.1", | ||
"tape": "^3.5.0" | ||
}, | ||
"jscsConfig": { | ||
"preset": "google", | ||
"maximumLineLength": 98, | ||
"requireBlocksOnNewline": true, | ||
"validateLineBreaks": "LF" | ||
} | ||
} |
# read-json-sync | ||
[![NPM version](https://badge.fury.io/js/read-json-sync.svg)](https://www.npmjs.org/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://coveralls.io/r/shinnn/read-json-sync) | ||
[![devDependency Status](https://david-dm.org/shinnn/read-json-sync/dev-status.svg)](https://david-dm.org/shinnn/read-json-sync#info=devDependencies) | ||
[![Coverage Status](https://img.shields.io/coveralls/shinnn/read-json-sync.svg)](https://david-dm.org/shinnn/read-json-sync) | ||
[![Dependency Status](https://img.shields.io/david/shinnn/read-json-sync.svg?label=deps)](https://david-dm.org/shinnn/read-json-sync) | ||
[![devDependency Status](https://img.shields.io/david/dev/shinnn/read-json-sync.svg?label=devDeps)](https://david-dm.org/shinnn/read-json-sync#info=devDependencies) | ||
@@ -20,7 +21,5 @@ A [Node](http://nodejs.org/) module to read and parse a JSON file synchronously | ||
*Check [read-json](https://github.com/azer/read-json) module if you want to read a JSON file asynchronously.* | ||
## Installation | ||
[Install with npm](https://www.npmjs.org/doc/cli/npm-install.html). | ||
[Use npm](https://docs.npmjs.com/cli/install). | ||
@@ -45,4 +44,4 @@ ```sh | ||
Copyright (c) 2014 [Shinnosuke Watanabe](https://github.com/shinnn) | ||
Copyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn) | ||
Licensed under [the MIT License](./LICENSE). |
Sorry, the diff of this file is not supported yet
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4366
6
1
1
9
46
1
+ Addedgraceful-fs@^3.0.5
+ Addedgraceful-fs@3.0.12(transitive)
+ Addednatives@1.1.6(transitive)