You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. # parse-node-version
  7. [![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]
  8. Turn node's process.version into something useful.
  9. ## Usage
  10. ```js
  11. var nodeVersion = require('parse-node-version')(process.version);
  12. console.log(
  13. nodeVersion.major,
  14. nodeVersion.minor,
  15. nodeVersion.patch,
  16. nodeVersion.pre,
  17. nodeVersion.build
  18. );
  19. ```
  20. ## API
  21. ### parseVersion(nodeVersionString)
  22. 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.
  23. ## License
  24. MIT
  25. [downloads-image]: http://img.shields.io/npm/dm/parse-node-version.svg
  26. [npm-url]: https://www.npmjs.com/package/parse-node-version
  27. [npm-image]: http://img.shields.io/npm/v/parse-node-version.svg
  28. [travis-url]: https://travis-ci.org/gulpjs/parse-node-version
  29. [travis-image]: http://img.shields.io/travis/gulpjs/parse-node-version.svg?label=travis-ci
  30. [appveyor-url]: https://ci.appveyor.com/project/gulpjs/parse-node-version
  31. [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/parse-node-version.svg?label=appveyor
  32. [coveralls-url]: https://coveralls.io/r/gulpjs/parse-node-version
  33. [coveralls-image]: http://img.shields.io/coveralls/gulpjs/parse-node-version/master.svg
  34. [gitter-url]: https://gitter.im/gulpjs/gulp
  35. [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg