+6
-5
| 'use strict'; | ||
| var path = require('path'); | ||
| var writeJsonFile = require('write-json-file'); | ||
| var opts = {indent: 2}; | ||
| const path = require('path'); | ||
| const writeJsonFile = require('write-json-file'); | ||
| module.exports = function (fp, data) { | ||
| const opts = {indent: 2}; | ||
| module.exports = (fp, data) => { | ||
| if (typeof fp !== 'string') { | ||
@@ -17,3 +18,3 @@ data = fp; | ||
| module.exports.sync = function (fp, data) { | ||
| module.exports.sync = (fp, data) => { | ||
| if (typeof fp !== 'string') { | ||
@@ -20,0 +21,0 @@ data = fp; |
+7
-4
| { | ||
| "name": "write-pkg", | ||
| "version": "1.0.0", | ||
| "version": "2.0.0", | ||
| "description": "Write a package.json file", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
| "engines": { | ||
| "node": ">=0.10.0" | ||
| "node": ">=4" | ||
| }, | ||
@@ -33,10 +33,13 @@ "scripts": { | ||
| "dependencies": { | ||
| "write-json-file": "^1.1.0" | ||
| "write-json-file": "^2.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "*", | ||
| "read-pkg": "^1.0.0", | ||
| "read-pkg": "^2.0.0", | ||
| "tempfile": "^1.1.1", | ||
| "xo": "*" | ||
| }, | ||
| "xo": { | ||
| "esnext": true | ||
| } | ||
| } |
+10
-10
@@ -18,14 +18,14 @@ # write-pkg [](https://travis-ci.org/sindresorhus/write-pkg) | ||
| ```js | ||
| var path = require('path'); | ||
| var writePkg = require('write-pkg'); | ||
| const path = require('path'); | ||
| const writePkg = require('write-pkg'); | ||
| writePkg({foo: true}).then(function () { | ||
| writePkg({foo: true}).then(() => { | ||
| console.log('done'); | ||
| }); | ||
| writePkg(__dirname, {foo: true}).then(function () { | ||
| writePkg(__dirname, {foo: true}).then(() => { | ||
| console.log('done'); | ||
| }); | ||
| writePkg(path.join('unicorn', 'package.json'), {foo: true}).then(function () { | ||
| writePkg(path.join('unicorn', 'package.json'), {foo: true}).then(() => { | ||
| console.log('done'); | ||
@@ -40,10 +40,10 @@ }); | ||
| Returns a promise. | ||
| Returns a `Promise`. | ||
| ### readPkg.sync([path], data) | ||
| ### writePkg.sync([path], data) | ||
| #### path | ||
| Type: `string` | ||
| Default: `.` | ||
| Type: `string`<br> | ||
| Default: `process.cwd()` | ||
@@ -61,2 +61,2 @@ Path to where the `package.json` file should be written or its directory. | ||
| MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
| MIT © [Sindre Sorhus](https://sindresorhus.com) |
3507
0.8%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated