Socket
Socket
Sign inDemoInstall

latest-version

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

latest-version - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

11

index.js
'use strict';
var packageJson = require('package-json');
module.exports = function (name, cb) {
packageJson(name.toLowerCase(), 'latest', function (err, json) {
if (err) {
cb(err);
return;
}
cb(null, json.version);
module.exports = function (name) {
return packageJson(name.toLowerCase(), 'latest').then(function (data) {
return data.version;
});
};
{
"name": "latest-version",
"version": "1.0.1",
"version": "2.0.0",
"description": "Get the latest version of a npm package",

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

},
"bin": "cli.js",
"engines": {

@@ -18,7 +17,6 @@ "node": ">=0.10.0"

"scripts": {
"test": "mocha"
"test": "xo && ava"
},
"files": [
"index.js",
"cli.js"
"index.js"
],

@@ -29,2 +27,3 @@ "keywords": [

"npm",
"pkg",
"package",

@@ -36,7 +35,13 @@ "package.json",

"dependencies": {
"package-json": "^1.0.0"
"package-json": "^2.0.0"
},
"devDependencies": {
"mocha": "*"
"ava": "*",
"xo": "*"
},
"xo": {
"ignores": [
"test.js"
]
}
}

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

```sh
```
$ npm install --save latest-version

@@ -19,28 +19,20 @@ ```

```js
var latestVersion = require('latest-version');
const latestVersion = require('latest-version');
latestVersion('pageres', function (err, version) {
latestVersion('ava').then(version => {
console.log(version);
//=> 0.2.3
//=> '0.2.0'
});
```
## CLI
```sh
$ npm install --global latest-version
latestVersion('@sindresorhus/df').then(version => {
console.log(version);
//=> '1.0.1'
});
```
```sh
$ latest-version --help
Usage
latest-version <package-name>
## Related
Example
latest-version pageres
0.4.1ersion pageres
0.2.3
```
- [latest-version-cli](https://github.com/sindresorhus/latest-version-cli) - CLI for this module
- [package-json](https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry

@@ -47,0 +39,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc