core-js-compat
Advanced tools
Comparing version 3.25.0 to 3.25.1
'use strict'; | ||
const cmp = require('semver/functions/cmp'); | ||
const semver = require('semver/functions/coerce'); | ||
// eslint-disable-next-line es-x/no-object-hasown -- safe | ||
const has = Object.hasOwn || Function.call.bind({}.hasOwnProperty); | ||
const has = Function.call.bind({}.hasOwnProperty); | ||
function semver(input) { | ||
if (input instanceof semver) return input; | ||
// eslint-disable-next-line new-cap -- ok | ||
if (!(this instanceof semver)) return new semver(input); | ||
const match = /(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(input); | ||
if (!match) throw TypeError(`Invalid version: ${ input }`); | ||
const [, $major, $minor, $patch] = match; | ||
this.major = +$major; | ||
this.minor = $minor ? +$minor : 0; | ||
this.patch = $patch ? +$patch : 0; | ||
} | ||
function compare(a, operator, b) { | ||
return cmp(semver(a), operator, semver(b)); | ||
semver.prototype.toString = function () { | ||
return `${ this.major }.${ this.minor }.${ this.patch }`; | ||
}; | ||
function compare($a, operator, $b) { | ||
const a = semver($a); | ||
const b = semver($b); | ||
for (const component of ['major', 'minor', 'patch']) { | ||
if (a[component] < b[component]) return operator === '<' || operator === '<=' || operator === '!='; | ||
if (a[component] > b[component]) return operator === '>' || operator === '>=' || operator === '!='; | ||
} return operator === '==' || operator === '<=' || operator === '>='; | ||
} | ||
@@ -10,0 +29,0 @@ |
{ | ||
"name": "core-js-compat", | ||
"description": "core-js compat", | ||
"version": "3.25.0", | ||
"version": "3.25.1", | ||
"repository": { | ||
@@ -11,5 +11,5 @@ "type": "git", | ||
"main": "index.js", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"browserslist": "^4.21.3", | ||
"semver": "7.0.0" | ||
"browserslist": "^4.21.3" | ||
}, | ||
@@ -16,0 +16,0 @@ "funding": { |
![logo](https://user-images.githubusercontent.com/2213682/146607186-8e13ddef-26a4-4ebf-befd-5aac9d77c090.png) | ||
<div align="center"> | ||
[![fundraising](https://opencollective.com/core-js/all/badge.svg?label=fundraising)](https://opencollective.com/core-js) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md) [![version](https://img.shields.io/npm/v/core-js-compat.svg)](https://www.npmjs.com/package/core-js-compat) [![tests](https://github.com/zloirock/core-js/workflows/tests/badge.svg)](https://github.com/zloirock/core-js/actions) [![eslint](https://github.com/zloirock/core-js/workflows/eslint/badge.svg)](https://github.com/zloirock/core-js/actions) | ||
</div> | ||
[`core-js-compat` package](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) contains data about the necessity of [`core-js`](https://github.com/zloirock/core-js) modules and API for getting a list of required core-js modules by browserslist query. | ||
@@ -4,0 +10,0 @@ |
Sorry, the diff of this file is too big to display
565822
1
22328
129
- Removedsemver@7.0.0
- Removedsemver@7.0.0(transitive)