Skip to content

Commit

Permalink
chore: add satisfies example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
omichelsen committed Nov 13, 2021
1 parent 3bf13b0 commit 0fc5477
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Note: Starting from v4 this library includes a ESM version which will automatica

Will return `1` if first version is greater, `0` if versions are equal, and `-1` if the second version is greater:

```javascript
```js
import compareVersions from 'compare-versions';

compareVersions('11.1.1', '10.0.0'); // 1
Expand All @@ -35,7 +35,7 @@ compareVersions('10.0.0', '11.1.1'); // -1

Can also be used for sorting:

```javascript
```js
const versions = [
'1.5.19',
'1.2.3',
Expand Down Expand Up @@ -87,7 +87,7 @@ satisfies('10.1.1', '>=10.2.2'); // false

Applies the same ruleset used comparing version numbers and returns a boolean:

```javascript
```js
import { validate } from 'compare-versions';

validate('1.0.0-rc.1'); // true
Expand All @@ -100,10 +100,11 @@ validate('foo'); // false
If included directly in the browser, `compareVersions()` is available on the global window:

```html
<script src="compare-versions/index.js"></script>
<script src=https://unpkg.com/compare-versions></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');
</script>
```

0 comments on commit 0fc5477

Please sign in to comment.