compare-versions
Advanced tools
Comparing version 4.1.4 to 5.0.0
{ | ||
"name": "compare-versions", | ||
"version": "4.1.4", | ||
"version": "5.0.0", | ||
"description": "Compare semver version strings to find greater, equal or lesser.", | ||
@@ -23,17 +23,22 @@ "repository": { | ||
"scripts": { | ||
"test": "c8 --reporter=lcov mocha" | ||
"build": "npm run build:esm && npm run build:umd", | ||
"build:esm": "tsc --module esnext --target es2017 --outDir lib/esm", | ||
"build:umd": "rollup lib/esm/index.js --format umd --name compareVersions --sourcemap -o lib/umd/index.js", | ||
"test": "c8 --reporter=lcov mocha -r ts-node/register test/**/*.ts" | ||
}, | ||
"main": "index.js", | ||
"module": "index.mjs", | ||
"types": "index.d.ts", | ||
"main": "./lib/umd/index.js", | ||
"module": "./lib/esm/index.js", | ||
"types": "./lib/esm/index.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"index.js", | ||
"index.mjs", | ||
"index.d.ts" | ||
"lib" | ||
], | ||
"devDependencies": { | ||
"@types/mocha": "^9.1.0", | ||
"c8": "^7.10.0", | ||
"mocha": "^10.0.0" | ||
"mocha": "^10.0.0", | ||
"rollup": "^2.78.1", | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.6.3" | ||
} | ||
} |
@@ -22,4 +22,6 @@ # compare-versions | ||
Note: Starting from v4 this library includes a ESM version which will automatically be selected by your bundler (webpack, parcel etc). The old CJS version is `index.js` and the new ESM version is `index.mjs`. | ||
__Note__: Starting from v5 the main export is now _named_ like so: `import { compareVersions } from 'compare-versions'`. | ||
__Note__: Starting from v4 this library includes a ESM version which will automatically be selected by your bundler (webpack, parcel etc). The CJS/UMD version is `lib/umd/index.js` and the new ESM version is `lib/esm/index.js`. | ||
## Usage | ||
@@ -30,3 +32,3 @@ | ||
```js | ||
import compareVersions from 'compare-versions'; | ||
import { compareVersions } from 'compare-versions'; | ||
@@ -90,3 +92,3 @@ compareVersions('11.1.1', '10.0.0'); // 1 | ||
Applies the same ruleset used comparing version numbers and returns a boolean: | ||
Applies the same rules used comparing version numbers and returns a boolean: | ||
@@ -103,12 +105,13 @@ ```js | ||
If included directly in the browser, `compareVersions()` is available on the global window: | ||
If included directly in the browser, the functions above are available on the global window under the `compareVersions` object: | ||
```html | ||
<script src=https://unpkg.com/compare-versions></script> | ||
<script src=https://unpkg.com/compare-versions/lib/umd/index.js></script> | ||
<script> | ||
window.compareVersions('11.0.0', '10.0.0'); | ||
window.compareVersions.compare('11.0.0', '10.0.0', '>'); | ||
window.compareVersions.validate('11.0.0'); | ||
window.compareVersions.satisfies('1.2.0', '^1.0.0'); | ||
const { compareVersions, compare, satisfies, validate } = window.compareVersions | ||
console.log(compareVersions('11.0.0', '10.0.0')) | ||
console.log(compare('11.0.0', '10.0.0', '>')) | ||
console.log(satisfies('1.2.0', '^1.0.0')) | ||
console.log(validate('11.0.0')) | ||
</script> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34587
8
370
114
6
1