Socket
Book a DemoInstallSign in
Socket

custver

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custver

A highly customizable version parser

latest
npmnpm
Version
0.0.2
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

custver Build Status

A highly customizable version parser

Usage

npm install custver --save

In you nodeJS applicaiton

var custver = require('custver');

Defining Version Formatting

Defining the version formatting can be done in two ways.

Selecting a predefined version format

This package comes with two predefined version formattings. These are;

  • alternative
  • symantic
custver.setOptions('alternative'); // Alternative version formatting
custver.setOptions('symantic'); // Symantic version formatting

Defining a custom version formatiing

Below is an example of the alternative version formatting.

custver.setOptions({
	versioning: {
		expression: /^(\d+)\.(\d+)\.(\d+)+/i
	},
	developmentStages : [
		{
			type: 'Alpha',
			expression: /\.v(\d*)$/i,
			order: '1'
		},
		{
			type: 'Beta',
			expression: /\.Beta(\d*)$/i,
			order: '2'
		},
		{
			type: 'Release Candidate',
			expression: /\.RC(\d*)$/i,
			order: '3'
		},
		{
			type: 'General Availability',
			expression: /\.GA$/i,
			order: '4'
		}
	],
	defaultStageOrder: 4 // A version such as 4.0.0 will be treated as a development stage of General Availability
});

#Comparison Methods These are the comparison methods that expesoed by the custver module. They comply with the version formatting that has been defined. Each function returns a bool.

	custver.gt(version1, version2); // version1 > version2
	custver.gte(version1, version2); // version1 >= version2
	custver.lt(version1, version2); // version1 < version2
	custver.lte(version1, version2); // version1 <= version2
	custver.eq(version1, version2); // version1 === version2
	custver.neq(version1, version2); // version1 !== version2

Keywords

versioning

FAQs

Package last updated on 17 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts