pax_global_header00006660000000000000000000000064131456601620014516gustar00rootroot0000000000000052 comment=fe89fd004f3b79826878d326cde65cc91b36f0c6 semver-greatest-satisfied-range-1.1.0/000077500000000000000000000000001314566016200176755ustar00rootroot00000000000000semver-greatest-satisfied-range-1.1.0/.editorconfig000066400000000000000000000003261314566016200223530ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf [*.md] trim_trailing_whitespace = false semver-greatest-satisfied-range-1.1.0/.eslintrc000066400000000000000000000000301314566016200215120ustar00rootroot00000000000000{ "extends": "gulp" } semver-greatest-satisfied-range-1.1.0/.gitattributes000066400000000000000000000000161314566016200225650ustar00rootroot00000000000000* text eol=lf semver-greatest-satisfied-range-1.1.0/.gitignore000066400000000000000000000011461314566016200216670ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Garbage files .DS_Store semver-greatest-satisfied-range-1.1.0/.jscsrc000066400000000000000000000000271314566016200211640ustar00rootroot00000000000000{ "preset": "gulp" } semver-greatest-satisfied-range-1.1.0/.travis.yml000066400000000000000000000002011314566016200217770ustar00rootroot00000000000000sudo: false language: node_js node_js: - '8' - '6' - '5' - '4' - '0.12' - '0.10' after_script: - npm run coveralls semver-greatest-satisfied-range-1.1.0/LICENSE000066400000000000000000000022221314566016200207000ustar00rootroot00000000000000The 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. semver-greatest-satisfied-range-1.1.0/README.md000066400000000000000000000035321314566016200211570ustar00rootroot00000000000000

# 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 semver-greatest-satisfied-range-1.1.0/appveyor.yml000066400000000000000000000007531314566016200222720ustar00rootroot00000000000000# http://www.appveyor.com/docs/appveyor-yml # http://www.appveyor.com/docs/lang/nodejs-iojs environment: matrix: # node.js - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "5" - nodejs_version: "6" - nodejs_version: "8" install: - ps: Install-Product node $env:nodejs_version - npm install test_script: - node --version - npm --version - cmd: npm test build: off # build version format version: "{build}" semver-greatest-satisfied-range-1.1.0/index.js000066400000000000000000000006111314566016200213400ustar00rootroot00000000000000'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; semver-greatest-satisfied-range-1.1.0/package.json000066400000000000000000000021751314566016200221700ustar00rootroot00000000000000{ "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" ] } semver-greatest-satisfied-range-1.1.0/test/000077500000000000000000000000001314566016200206545ustar00rootroot00000000000000semver-greatest-satisfied-range-1.1.0/test/.eslintrc000066400000000000000000000000351314566016200224760ustar00rootroot00000000000000{ "extends": "gulp/test" } semver-greatest-satisfied-range-1.1.0/test/index.js000066400000000000000000000031211314566016200223160ustar00rootroot00000000000000'use strict'; var expect = require('expect'); var findRange = require('../'); describe('findRange', function() { it('works with different ranges', function(done) { var range = findRange('1.0.0', ['^0.9.0', '^1.0.0', '^2.0.0']); expect(range).toEqual('^1.0.0'); done(); }); it('works with multiple matching ranges', function(done) { var range = findRange('1.2.0', ['^1.0.0', '^1.1.0', '^1.2.0']); expect(range).toEqual('^1.2.0'); done(); }); it('returns null with no matching ranges', function(done) { var range = findRange('1.2.0', ['~1.0.0', '~1.1.0']); expect(range).toBe(null); done(); }); it('returns null when given no ranges', function(done) { var range = findRange('1.2.0'); expect(range).toBe(null); done(); }); it('prerelease ranges', function(done) { var range = findRange('1.0.0-alpha.1', ['^1.0.0-alpha.1', '^1.0.0-beta.1']); expect(range).toEqual('^1.0.0-alpha.1'); done(); }); it('prerelease ranges against release version', function(done) { var range = findRange('1.0.0', ['^1.0.0-alpha.1', '^1.0.0-beta.1']); expect(range).toEqual('^1.0.0-beta.1'); done(); }); it('prerelease and release ranges', function(done) { var range = findRange('1.2.0', ['^1.0.0', '^1.0.0-alpha.1', '^1.0.0-beta.1']); expect(range).toEqual('^1.0.0'); done(); }); it('prerelease and release ranges against prerelease version', function(done) { var range = findRange('1.0.0-beta.1', ['^1.0.0', '^1.0.0-alpha.1', '^1.0.0-alpha.2']); expect(range).toEqual('^1.0.0-alpha.2'); done(); }); });