Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including painless-version with all npm packages installed. Try it out:

var painlessVersion = require("painless-version")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

painless-version v1.2.3

Intuitive version management abstraction

painless-version

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Intuitive version management abstraction

Install

npm i --save painless-version

Getting Started

```js const pv = require('painless-version');

const version = '5.3.5'; pv.test(1.2.3 < ${version}); // => true


## Functions

### test(expression: String)

Evaluate comparison string of form `LHS CMP RHS` where `LHS` and `RHS` are
version strings and `CMP` is one of `<`, `<=`, `>`, `>=`, `=`.

Under the hood this uses [compare-versions](https://www.npmjs.com/package/compare-versions).

### updateDeprecationHeaders(headers: {}, { deprecationDate: Date, sunsetDate: Date })

Modifies the headers object in place assuming this is a response headers object.

Updates headers [deprecation](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html) and [sunset](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html#rfc.section.5)

Existing headers are only overwritten if the date present is further in the future.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free