Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

version-range

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

version-range - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0-next.1623648513.36f971faeb7d83ab076d3928d71988c85b062871

11

compiled-types/index.d.ts

@@ -1,3 +0,3 @@

export declare type Version = string | number
export declare type Range = Version | Version[]
export declare type Version = string | number;
export declare type Range = Version | Version[];
/**

@@ -9,6 +9,3 @@ * Compare two versions quickly.

*/
export default function withinVersionRange(
subject: Version,
range: Range
): boolean
//# sourceMappingURL=index.d.ts.map
export default function withinVersionRange(subject: Version, range: Range): boolean;
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,3 @@

import versionCompare from 'version-compare'
var regex = /^([<>=]*)\s*([\d.]+)\s*$/
import versionCompare from 'version-compare';
var regex = /^([<>=]*)\s*([\d.]+)\s*$/;
/**

@@ -10,39 +10,37 @@ * Compare two versions quickly.

export default function withinVersionRange(subject, range) {
var result = false
if (!Array.isArray(range)) range = String(range).split(/\s*\|\|\s*/)
for (var _i = 0, range_1 = range; _i < range_1.length; _i++) {
var part = range_1[_i]
var parts = String(part).match(regex) || []
var _ = parts[0],
comparator = parts[1],
version = parts[2]
if (!version)
throw new Error('version range was invalid: ' + JSON.stringify(part))
var diff = versionCompare(subject, version)
var pass = false
switch (comparator) {
case '>=':
pass = diff >= 0
break
case '>':
pass = diff === 1
break
case '<':
pass = diff === -1
break
case '<=':
pass = diff <= 0
break
case '=':
case '':
pass = diff === 0
break
default:
throw new Error(
'version range comparator was invalid: ' + JSON.stringify(part)
)
}
if (pass) result = true
}
return result
var result = false;
if (!Array.isArray(range))
range = String(range).split(/\s*\|\|\s*/);
for (var _i = 0, range_1 = range; _i < range_1.length; _i++) {
var part = range_1[_i];
var parts = String(part).match(regex) || [];
var _ = parts[0], comparator = parts[1], version = parts[2];
if (!version)
throw new Error("version range was invalid: " + JSON.stringify(part));
var diff = versionCompare(subject, version);
var pass = false;
switch (comparator) {
case '>=':
pass = diff >= 0;
break;
case '>':
pass = diff === 1;
break;
case '<':
pass = diff === -1;
break;
case '<=':
pass = diff <= 0;
break;
case '=':
case '':
pass = diff === 0;
break;
default:
throw new Error("version range comparator was invalid: " + JSON.stringify(part));
}
if (pass)
result = true;
}
return result;
}

@@ -1,3 +0,1 @@

{
"type": "module"
}
{"type": "module"}

@@ -1,10 +0,8 @@

'use strict'
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod }
}
Object.defineProperty(exports, '__esModule', { value: true })
var version_compare_1 = __importDefault(require('version-compare'))
var regex = /^([<>=]*)\s*([\d.]+)\s*$/
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var version_compare_1 = __importDefault(require("version-compare"));
var regex = /^([<>=]*)\s*([\d.]+)\s*$/;
/**

@@ -17,40 +15,38 @@ * Compare two versions quickly.

function withinVersionRange(subject, range) {
var result = false
if (!Array.isArray(range)) range = String(range).split(/\s*\|\|\s*/)
for (var _i = 0, range_1 = range; _i < range_1.length; _i++) {
var part = range_1[_i]
var parts = String(part).match(regex) || []
var _ = parts[0],
comparator = parts[1],
version = parts[2]
if (!version)
throw new Error('version range was invalid: ' + JSON.stringify(part))
var diff = version_compare_1.default(subject, version)
var pass = false
switch (comparator) {
case '>=':
pass = diff >= 0
break
case '>':
pass = diff === 1
break
case '<':
pass = diff === -1
break
case '<=':
pass = diff <= 0
break
case '=':
case '':
pass = diff === 0
break
default:
throw new Error(
'version range comparator was invalid: ' + JSON.stringify(part)
)
}
if (pass) result = true
}
return result
var result = false;
if (!Array.isArray(range))
range = String(range).split(/\s*\|\|\s*/);
for (var _i = 0, range_1 = range; _i < range_1.length; _i++) {
var part = range_1[_i];
var parts = String(part).match(regex) || [];
var _ = parts[0], comparator = parts[1], version = parts[2];
if (!version)
throw new Error("version range was invalid: " + JSON.stringify(part));
var diff = version_compare_1.default(subject, version);
var pass = false;
switch (comparator) {
case '>=':
pass = diff >= 0;
break;
case '>':
pass = diff === 1;
break;
case '<':
pass = diff === -1;
break;
case '<=':
pass = diff <= 0;
break;
case '=':
case '':
pass = diff === 0;
break;
default:
throw new Error("version range comparator was invalid: " + JSON.stringify(part));
}
if (pass)
result = true;
}
return result;
}
exports.default = withinVersionRange
exports.default = withinVersionRange;

@@ -1,3 +0,1 @@

{
"type": "commonjs"
}
{"type": "commonjs"}
# History
## v1.2.0 2021 June 14
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v1.1.0 2020 October 29

@@ -4,0 +8,0 @@

@@ -18,3 +18,3 @@ <!-- LICENSEFILE/ -->

The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

@@ -21,0 +21,0 @@ 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.

{
"name": "version-range",
"version": "1.1.0",
"version": "1.2.0-next.1623648513.36f971faeb7d83ab076d3928d71988c85b062871",
"description": "Check version ranges like `>=N` and `X || Y || Z` with support for Node.js, Web Browsers, Deno, and TypeScript.",

@@ -10,6 +10,2 @@ "homepage": "https://github.com/bevry/version-range",

"conditional",
"deno",
"deno-edition",
"deno-entry",
"denoland",
"es5",

@@ -32,3 +28,3 @@ "export-default",

"list": [
"travisci",
"githubworkflow",
"npmversion",

@@ -50,2 +46,3 @@ "npmdownloads",

"config": {
"githubWorkflow": "bevry",
"githubSponsorsUsername": "balupton",

@@ -60,3 +57,2 @@ "buymeacoffeeUsername": "balupton",

"wishlistURL": "https://bevry.me/wishlist",
"travisTLD": "com",
"githubUsername": "bevry",

@@ -73,2 +69,5 @@ "githubRepository": "version-range",

],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"bugs": {

@@ -107,3 +106,3 @@ "url": "https://github.com/bevry/version-range/issues"

"engines": {
"node": "4 || 6 || 8 || 10 || 12 || 14 || 15",
"node": "4 || 6 || 8 || 10 || 12 || 14",
"browsers": false

@@ -123,19 +122,5 @@ }

"engines": {
"node": "12 || 14 || 15",
"node": "12 || 14",
"browsers": false
}
},
{
"description": "TypeScript source code made to be compatible with Deno",
"directory": "edition-deno",
"entry": "index.ts",
"tags": [
"typescript",
"import",
"deno"
],
"engines": {
"deno": true,
"browsers": false
}
}

@@ -152,22 +137,21 @@ ],

},
"deno": "edition-deno/index.ts",
"dependencies": {
"version-compare": "^1.0.0"
"version-compare": "^1.2.0"
},
"devDependencies": {
"@bevry/update-contributors": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.1",
"assert-helpers": "^8.1.0",
"eslint": "^7.12.1",
"eslint": "^7.28.0",
"eslint-config-bevry": "^3.23.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"kava": "3.2.0",
"make-deno-edition": "^1.2.0",
"prettier": "^2.1.2",
"projectz": "^2.17.0",
"surge": "^0.21.6",
"typedoc": "^0.19.2",
"typescript": "^4.0.5",
"prettier": "^2.3.1",
"projectz": "^2.18.0",
"surge": "^0.23.0",
"typedoc": "^0.20.36",
"typescript": "^4.3.2",
"valid-directory": "^3.5.0"

@@ -186,3 +170,3 @@ },

"our:meta:docs": "npm run our:meta:docs:typedoc",
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --mode file --exclude '**/+(*test*|node_modules)' --excludeExternals --name \"$npm_package_name\" --readme ./README.md --out ./docs ./source",
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --exclude '**/+(*test*|node_modules)' --excludeExternals --out ./docs ./source",
"our:meta:projectz": "projectz compile",

@@ -218,6 +202,3 @@ "our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",

]
},
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
]
}
}

@@ -10,3 +10,3 @@ <!-- TITLE/ -->

<span class="badge-travisci"><a href="http://travis-ci.com/bevry/version-range" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/version-range/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-githubworkflow"><a href="https://github.com/bevry/version-range/actions?query=workflow%3Abevry" title="View the status of this project's GitHub Workflow: bevry"><img src="https://github.com/bevry/version-range/workflows/bevry/badge.svg" alt="Status of the GitHub Workflow: bevry" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/version-range" title="View this project on NPM"><img src="https://img.shields.io/npm/v/version-range.svg" alt="NPM version" /></a></span>

@@ -64,8 +64,2 @@ <span class="badge-npmdownloads"><a href="https://npmjs.org/package/version-range" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/version-range.svg" alt="NPM downloads" /></a></span>

<a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative for Node.js"><h3>Deno</h3></a>
``` typescript
import pkg from 'https://unpkg.com/version-range@^1.1.0/edition-deno/index.ts'
```
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>

@@ -78,4 +72,3 @@

<li><code>version-range/edition-es5/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES5 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>version-range/edition-es5-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES5 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<li><code>version-range/edition-deno/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code made to be compatible with <a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative to Node.js">Deno</a></li></ul>
<li><code>version-range/edition-es5-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES5 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li></ul>

@@ -82,0 +75,0 @@ <!-- /INSTALL -->

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc