package/package.json000644 000765 000024 0000002175 13145660162013026 0ustar00000000 000000 { "name": "semver-greatest-satisfied-range", "version": "1.1.0", "description": "Find the greatest satisfied semver range from an array of ranges.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Blaine Bublitz " ], "repository": "gulpjs/semver-greatest-satisfied-range", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "index.js", "LICENSE" ], "scripts": { "lint": "eslint . && jscs index.js test/", "pretest": "npm run lint", "test": "mocha --async-only", "cover": "istanbul cover _mocha --report lcovonly", "coveralls": "npm run cover && istanbul-coveralls" }, "dependencies": { "sver-compat": "^1.5.0" }, "devDependencies": { "eslint": "^1.7.3", "eslint-config-gulp": "^2.0.0", "expect": "^1.19.0", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "jscs": "^2.3.5", "jscs-preset-gulp": "^1.0.0", "mocha": "^2.4.5" }, "keywords": [ "semver", "range", "max", "satisfied", "range", "array", "greatest" ] } package/README.md000644 000765 000024 0000003532 13145660032012011 0ustar00000000 000000

# semver-greatest-satisfied-range [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] Find the greatest satisfied semver range from an array of ranges. ## Usage ```js var findRange = require('semver-greatest-satisfied-range'); var range = findRange('1.1.0', ['^1.0.0', '^1.1.0', '^1.2.0']); // range === '^1.1.0' ``` ## API ### `findRange(version, rangeArray)` Takes a version and array of ranges, returns the greatest satisfied range. Range support is defined by [sver-compat][range-support]. ## License MIT [range-support]: https://github.com/phated/sver-compat#range-support [downloads-image]: http://img.shields.io/npm/dm/semver-greatest-satisfied-range.svg [npm-url]: https://www.npmjs.com/package/semver-greatest-satisfied-range [npm-image]: http://img.shields.io/npm/v/semver-greatest-satisfied-range.svg [travis-url]: https://travis-ci.org/gulpjs/semver-greatest-satisfied-range [travis-image]: http://img.shields.io/travis/gulpjs/semver-greatest-satisfied-range.svg?label=travis-ci [appveyor-url]: https://ci.appveyor.com/project/gulpjs/semver-greatest-satisfied-range [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/semver-greatest-satisfied-range.svg?label=appveyor [coveralls-url]: https://coveralls.io/r/gulpjs/semver-greatest-satisfied-range [coveralls-image]: http://img.shields.io/coveralls/gulpjs/semver-greatest-satisfied-range/master.svg [gitter-url]: https://gitter.im/gulpjs/gulp [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg package/LICENSE000644 000765 000024 0000002222 13145660032011532 0ustar00000000 000000 The MIT License (MIT) Copyright (c) 2015, 2017 Blaine Bublitz , Eric Schoffstall and other contributors 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. package/index.js000644 000765 000024 0000000611 13145660032012172 0ustar00000000 000000 'use strict'; var SemverRange = require('sver-compat').SemverRange; function findRange(version, ranges) { ranges = ranges || []; function matches(range) { return SemverRange.match(range, version, true); } var validRanges = ranges.filter(matches); var sortedRanges = validRanges.sort(SemverRange.compare); return sortedRanges.pop() || null; } module.exports = findRange;