Socket
Socket
Sign inDemoInstall

write-pkg

Package Overview
Dependencies
10
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

11

index.js
'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;

{
"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
}
}

@@ -18,14 +18,14 @@ # write-pkg [![Build Status](https://travis-ci.org/sindresorhus/write-pkg.svg?branch=master)](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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc