pax_global_header00006660000000000000000000000064130657163320014520gustar00rootroot0000000000000052 comment=2181e0f3c18d71c43bc6656c9cd09ba9bccd6c68 latest-version-3.1.0/000077500000000000000000000000001306571633200145005ustar00rootroot00000000000000latest-version-3.1.0/.editorconfig000066400000000000000000000002761306571633200171620ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 latest-version-3.1.0/.gitattributes000066400000000000000000000000351306571633200173710ustar00rootroot00000000000000* text=auto *.js text eol=lf latest-version-3.1.0/.gitignore000066400000000000000000000000151306571633200164640ustar00rootroot00000000000000node_modules latest-version-3.1.0/.travis.yml000066400000000000000000000000531306571633200166070ustar00rootroot00000000000000language: node_js node_js: - '6' - '4' latest-version-3.1.0/index.js000066400000000000000000000002211306571633200161400ustar00rootroot00000000000000'use strict'; const packageJson = require('package-json'); module.exports = name => packageJson(name.toLowerCase()).then(data => data.version); latest-version-3.1.0/license000066400000000000000000000021371306571633200160500ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. latest-version-3.1.0/package.json000066400000000000000000000012621306571633200167670ustar00rootroot00000000000000{ "name": "latest-version", "version": "3.1.0", "description": "Get the latest version of an npm package", "license": "MIT", "repository": "sindresorhus/latest-version", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "latest", "version", "npm", "pkg", "package", "package.json", "current", "module" ], "dependencies": { "package-json": "^4.0.0" }, "devDependencies": { "ava": "*", "semver-regex": "^1.0.0", "xo": "*" } } latest-version-3.1.0/readme.md000066400000000000000000000020501306571633200162540ustar00rootroot00000000000000# latest-version [![Build Status](https://travis-ci.org/sindresorhus/latest-version.svg?branch=master)](https://travis-ci.org/sindresorhus/latest-version) > Get the latest version of an npm package Fetches the version directly from the registry instead of depending on the massive [npm](https://github.com/npm/npm/blob/8b5e7b6ae5b4cd2d7d62eaf93b1428638b387072/package.json#L37-L85) module like the [latest](https://github.com/bahamas10/node-latest) module does. ## Install ``` $ npm install --save latest-version ``` ## Usage ```js const latestVersion = require('latest-version'); latestVersion('ava').then(version => { console.log(version); //=> '0.18.0' }); latestVersion('@sindresorhus/df').then(version => { console.log(version); //=> '1.0.1' }); ``` ## Related - [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 ## License MIT © [Sindre Sorhus](https://sindresorhus.com) latest-version-3.1.0/test.js000066400000000000000000000004131306571633200160130ustar00rootroot00000000000000import test from 'ava'; import semverRegex from 'semver-regex'; import m from '.'; test('latest version', async t => { t.regex(await m('ava'), semverRegex()); }); test('latest version scoped', async t => { t.regex(await m('@sindresorhus/df'), semverRegex()); });