Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

package-json

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

package-json - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

16

index.js
'use strict';
var got = require('got');
var registryUrl = require('registry-url');
var rc = require('rc');
module.exports = function (name, version) {
var url = registryUrl(name.split('/')[0]) +
var scope = name.split('/')[0];
var url = registryUrl(scope) +
encodeURIComponent(name).replace(/^%40/, '@');
var npmrc = rc('npm');
var token = npmrc[scope + ':_authToken'] || npmrc['//registry.npmjs.org/:_authToken'];
var headers = {};
return got(url, {json: true})
if (token) {
headers.authorization = 'Bearer ' + token;
}
return got(url, {
json: true,
headers: headers
})
.then(function (res) {

@@ -11,0 +23,0 @@ var data = res.body;

3

package.json
{
"name": "package-json",
"version": "2.0.0",
"version": "2.0.1",
"description": "Get the package.json of a package from the npm registry",

@@ -34,2 +34,3 @@ "license": "MIT",

"got": "^4.2.0",
"rc": "^1.1.2",
"registry-url": "^3.0.3"

@@ -36,0 +37,0 @@ },

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

- [latest-version](https://github.com/sindresorhus/latest-version) - Get the latest version of a npm package
- [npm-keyword](https://github.com/sindresorhus/npm-keyword) - Get a list of npm packages with a certain keyword

@@ -43,0 +44,0 @@ - [npm-user](https://github.com/sindresorhus/npm-user) - Get user info of a npm user

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc