Skip to content

muhammaddadu/custver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • semantic
custver.setOptions('alternative'); // Alternative version formatting
custver.setOptions('semantic'); // 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

About

A highly customizable version parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published