package-json
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -6,2 +6,4 @@ 'use strict'; | ||
module.exports = function (name, version, cb) { | ||
var url = registryUrl(name.split('/')[0]); | ||
if (typeof version !== 'string') { | ||
@@ -12,3 +14,3 @@ cb = version; | ||
got(registryUrl + encodeURIComponent(name) + '/' + version, function (err, data) { | ||
got(url + encodeURIComponent(name) + '/' + version, function (err, data) { | ||
if (err && err.code === 404) { | ||
@@ -15,0 +17,0 @@ cb(new Error('Package or version doesn\'t exist')); |
{ | ||
"name": "package-json", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Get the package.json of a package from the npm registry", | ||
@@ -28,7 +28,9 @@ "license": "MIT", | ||
"json", | ||
"module" | ||
"module", | ||
"scope", | ||
"scoped" | ||
], | ||
"dependencies": { | ||
"got": "^2.4.0", | ||
"registry-url": "^2.0.0" | ||
"registry-url": "^3.0.0" | ||
}, | ||
@@ -35,0 +37,0 @@ "devDependencies": { |
@@ -22,2 +22,8 @@ # package-json [![Build Status](https://travis-ci.org/sindresorhus/package-json.svg?branch=master)](https://travis-ci.org/sindresorhus/package-json) | ||
}); | ||
// also works with scoped packages | ||
packageJson('@company/package', 'latest', function (err, json) { | ||
console.log(json); | ||
//=> { name: 'package', ... } | ||
}); | ||
``` | ||
@@ -24,0 +30,0 @@ |
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
3347
21
47
+ Addeddeep-extend@0.6.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedregistry-url@3.1.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
- Removeddeep-extend@0.2.11(transitive)
- Removedminimist@0.0.10(transitive)
- Removedrc@0.5.5(transitive)
- Removedregistry-url@2.1.0(transitive)
- Removedstrip-json-comments@0.1.3(transitive)
Updatedregistry-url@^3.0.0