Skip to content

Commit

Permalink
docs: Add "Constants" section to README
Browse files Browse the repository at this point in the history
documents `RELEASE_TYPES` and `SEMVER_SPEC_VERSION`
  • Loading branch information
hcharley authored and wraithgar committed Apr 10, 2023
1 parent 48d8f8f commit c5d29df
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Expand Up @@ -513,6 +513,40 @@ ex.
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
* `s.clean('~1.0.0')`: `null`
## Constants
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
### `RELEASE_TYPES`
- major
- premajor
- minor
- preminor
- patch
- prepatch
- prerelease
```
const semver = require('semver');
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
console.log('This is a valid release type!');
} else {
console.warn('This is NOT a valid release type!');
}
```
### `SEMVER_SPEC_VERSION`
2.0.0
```
const semver = require('semver');
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
```
## Exported Modules
<!--
Expand Down Expand Up @@ -566,3 +600,4 @@ The following modules are available:
* `require('semver/ranges/outside')`
* `require('semver/ranges/to-comparators')`
* `require('semver/ranges/valid')`

0 comments on commit c5d29df

Please sign in to comment.