Comparing version 1.1.0 to 2.0.0
21
index.js
'use strict'; | ||
var path = require('path'); | ||
var loadJsonFile = require('load-json-file'); | ||
var normalizePackageData = require('normalize-package-data'); | ||
var pathType = require('path-type'); | ||
const path = require('path'); | ||
const loadJsonFile = require('load-json-file'); | ||
const pathType = require('path-type'); | ||
module.exports = function (fp, opts) { | ||
module.exports = (fp, opts) => { | ||
if (typeof fp !== 'string') { | ||
@@ -16,3 +15,3 @@ opts = fp; | ||
return pathType.dir(fp) | ||
.then(function (isDir) { | ||
.then(isDir => { | ||
if (isDir) { | ||
@@ -24,5 +23,5 @@ fp = path.join(fp, 'package.json'); | ||
}) | ||
.then(function (x) { | ||
.then(x => { | ||
if (opts.normalize !== false) { | ||
normalizePackageData(x); | ||
require('normalize-package-data')(x); | ||
} | ||
@@ -34,3 +33,3 @@ | ||
module.exports.sync = function (fp, opts) { | ||
module.exports.sync = (fp, opts) => { | ||
if (typeof fp !== 'string') { | ||
@@ -44,6 +43,6 @@ opts = fp; | ||
var x = loadJsonFile.sync(fp); | ||
const x = loadJsonFile.sync(fp); | ||
if (opts.normalize !== false) { | ||
normalizePackageData(x); | ||
require('normalize-package-data')(x); | ||
} | ||
@@ -50,0 +49,0 @@ |
{ | ||
"name": "read-pkg", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Read a package.json file", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=4" | ||
}, | ||
@@ -35,5 +35,5 @@ "scripts": { | ||
"dependencies": { | ||
"load-json-file": "^1.0.0", | ||
"load-json-file": "^2.0.0", | ||
"normalize-package-data": "^2.3.2", | ||
"path-type": "^1.0.0" | ||
"path-type": "^2.0.0" | ||
}, | ||
@@ -43,3 +43,6 @@ "devDependencies": { | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
@@ -24,5 +24,5 @@ # read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg) | ||
```js | ||
var readPkg = require('read-pkg'); | ||
const readPkg = require('read-pkg'); | ||
readPkg().then(function (pkg) { | ||
readPkg().then(pkg => { | ||
console.log(pkg); | ||
@@ -32,3 +32,3 @@ //=> {name: 'read-pkg', ...} | ||
readPkg(__dirname).then(function (pkg) { | ||
readPkg(__dirname).then(pkg => { | ||
console.log(pkg); | ||
@@ -38,3 +38,3 @@ //=> {name: 'read-pkg', ...} | ||
readPkg(path.join('unicorn', 'package.json')).then(function (pkg) { | ||
readPkg(path.join('unicorn', 'package.json')).then(pkg => { | ||
console.log(pkg); | ||
@@ -50,3 +50,3 @@ //=> {name: 'read-pkg', ...} | ||
Returns a promise that resolves to the parsed JSON. | ||
Returns a `Promise` for the parsed JSON. | ||
@@ -59,3 +59,3 @@ ### readPkg.sync([path], [options]) | ||
Type: `string` | ||
Type: `string`<br> | ||
Default: `.` | ||
@@ -69,3 +69,3 @@ | ||
Type: `boolean` | ||
Type: `boolean`<br> | ||
Default: `true` | ||
@@ -85,2 +85,2 @@ | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
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
4367
37
+ Addedload-json-file@2.0.0(transitive)
+ Addedpath-type@2.0.0(transitive)
+ Addedstrip-bom@3.0.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
Updatedload-json-file@^2.0.0
Updatedpath-type@^2.0.0