@v4fire/core
Version:
V4Fire core library
26 lines (19 loc) • 653 B
Markdown
# core/semver
This module provides a function to compare string versions by using semver strategy.
```js
import check from 'core/semver';
console.log(check('1.4.1', '1.5.2', '>')); // false
console.log(check('1', '1.5.2', '==')); // true
console.log(check('2.4.1', '2.4', '<=')); // true
console.log(check('2.4', '2.4.2', '^=')); // true
```
## Supported Comparisons
> Note:
> The module currently supports only a numeric comparison with x-ranges. Without `beta`, `alpha` or `rc` postfixes.
- `==` equal
- `^=` caret range
- `~=` tilda range
- `>` greater than
- `<` less than
- `>=` greater than or equal to
- `<=` less than or equal to