Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | <p align="center">
|
---|
| 2 | <a href="http://gulpjs.com">
|
---|
| 3 | <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
---|
| 4 | </a>
|
---|
| 5 | </p>
|
---|
| 6 |
|
---|
| 7 | # parse-node-version
|
---|
| 8 |
|
---|
| 9 | [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
---|
| 10 |
|
---|
| 11 | Turn node's process.version into something useful.
|
---|
| 12 |
|
---|
| 13 | ## Usage
|
---|
| 14 |
|
---|
| 15 | ```js
|
---|
| 16 | var nodeVersion = require('parse-node-version')(process.version);
|
---|
| 17 |
|
---|
| 18 | console.log(
|
---|
| 19 | nodeVersion.major,
|
---|
| 20 | nodeVersion.minor,
|
---|
| 21 | nodeVersion.patch,
|
---|
| 22 | nodeVersion.pre,
|
---|
| 23 | nodeVersion.build
|
---|
| 24 | );
|
---|
| 25 | ```
|
---|
| 26 |
|
---|
| 27 | ## API
|
---|
| 28 |
|
---|
| 29 | ### parseVersion(nodeVersionString)
|
---|
| 30 |
|
---|
| 31 | Takes a node version string (usually `process.version`) and returns an object with the `major`/`minor`/`patch` (which will all be numbers) and `pre`/`build` keys (which will always be a string). If the version doesn't contain any pre-release or build information, the properties will be returned as empty string.
|
---|
| 32 |
|
---|
| 33 | ## License
|
---|
| 34 |
|
---|
| 35 | MIT
|
---|
| 36 |
|
---|
| 37 | [downloads-image]: http://img.shields.io/npm/dm/parse-node-version.svg
|
---|
| 38 | [npm-url]: https://www.npmjs.com/package/parse-node-version
|
---|
| 39 | [npm-image]: http://img.shields.io/npm/v/parse-node-version.svg
|
---|
| 40 |
|
---|
| 41 | [travis-url]: https://travis-ci.org/gulpjs/parse-node-version
|
---|
| 42 | [travis-image]: http://img.shields.io/travis/gulpjs/parse-node-version.svg?label=travis-ci
|
---|
| 43 |
|
---|
| 44 | [appveyor-url]: https://ci.appveyor.com/project/gulpjs/parse-node-version
|
---|
| 45 | [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/parse-node-version.svg?label=appveyor
|
---|
| 46 |
|
---|
| 47 | [coveralls-url]: https://coveralls.io/r/gulpjs/parse-node-version
|
---|
| 48 | [coveralls-image]: http://img.shields.io/coveralls/gulpjs/parse-node-version/master.svg
|
---|
| 49 |
|
---|
| 50 | [gitter-url]: https://gitter.im/gulpjs/gulp
|
---|
| 51 | [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
---|
Note:
See
TracBrowser
for help on using the repository browser.