Socket
Socket
Sign inDemoInstall

package-json

Package Overview
Dependencies
52
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.1 to 5.0.0

12

index.js

@@ -8,3 +8,3 @@ 'use strict';

module.exports = (name, opts) => {
module.exports = (name, options) => {
const scope = name.split('/')[0];

@@ -15,5 +15,5 @@ const regUrl = registryUrl(scope);

opts = Object.assign({
options = Object.assign({
version: 'latest'
}, opts);
}, options);

@@ -24,3 +24,3 @@ const headers = {

if (opts.fullMetadata) {
if (options.fullMetadata) {
delete headers.accept;

@@ -36,5 +36,5 @@ }

let data = res.body;
let version = opts.version;
let {version} = options;
if (opts.allVersions) {
if (options.allVersions) {
return data;

@@ -41,0 +41,0 @@ }

{
"name": "package-json",
"version": "4.0.1",
"description": "Get metadata of a package from the npm registry",
"license": "MIT",
"repository": "sindresorhus/package-json",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"npm",
"registry",
"package",
"pkg",
"package.json",
"json",
"module",
"scope",
"scoped"
],
"dependencies": {
"got": "^6.7.1",
"registry-auth-token": "^3.0.1",
"registry-url": "^3.0.3",
"semver": "^5.1.0"
},
"devDependencies": {
"ava": "*",
"mock-private-registry": "^1.1.0",
"xo": "*"
}
"name": "package-json",
"version": "5.0.0",
"description": "Get metadata of a package from the npm registry",
"license": "MIT",
"repository": "sindresorhus/package-json",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"npm",
"registry",
"package",
"pkg",
"package.json",
"json",
"module",
"scope",
"scoped"
],
"dependencies": {
"got": "^8.3.1",
"registry-auth-token": "^3.3.2",
"registry-url": "^3.1.0",
"semver": "^5.5.0"
},
"devDependencies": {
"ava": "*",
"mock-private-registry": "^1.1.2",
"xo": "*"
}
}

@@ -9,3 +9,3 @@ # package-json [![Build Status](https://travis-ci.org/sindresorhus/package-json.svg?branch=master)](https://travis-ci.org/sindresorhus/package-json)

```
$ npm install --save package-json
$ npm install package-json
```

@@ -19,12 +19,9 @@

packageJson('ava').then(json => {
console.log(json);
(async () => {
console.log(await packageJson('ava'));
//=> {name: 'ava', ...}
});
// Also works with scoped packages
packageJson('@sindresorhus/df').then(json => {
console.log(json);
//=> {name: '@sindresorhus/df', ...}
});
// Also works with scoped packages
console.log(await packageJson('@sindresorhus/df'));
})();
```

@@ -56,6 +53,6 @@

- `1` - get the latest `1.x.x`
- `1.2` - get the latest `1.2.x`
- `^1.2.3` - get the latest `1.x.x` but at least `1.2.3`
- `~1.2.3` - get the latest `1.2.x` but at least `1.2.3`
- `1` - Get the latest `1.x.x`
- `1.2` - Get the latest `1.2.x`
- `^1.2.3` - Get the latest `1.x.x` but at least `1.2.3`
- `~1.2.3` - Get the latest `1.2.x` but at least `1.2.3`

@@ -62,0 +59,0 @@ ##### fullMetadata

Sorry, the diff of this file is not supported yet

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