@nybr.js/semverize

1.0.1 • Public • Published

@nybr.js/semverize v1.0.1

Semverize ESModule: semverizes difference between two dates.

Table of Contents

Installation

Install this package using NPM.

$ npm install --save @nybr.js/semverize

Usage

The module consists of one method and can be used as following.

// Import/require the module
const semverize = require("@nybr.js/semverize");

// Use the result of the semverize function
const result = semverize(fromDate, toDate[, prefix]);

Parameters

  • fromDate: Date object (required)
    • Date used as the beginning of the difference
  • toDate: Date object (required)
    • Date used as the end of the difference
  • prefix: String (optional)
    • Possible prefix, e.g. 'v'

Examples

Example without a prefix.

// Returns '5.9.5'
semverize(new Date("2000-07-05"), new Date("2006-04-10"));

Example with a prefix.

// Returns 'v5.9.5'
semverize(new Date("2000-07-05"), new Date("2006-04-10"), "v");

Example with an invalid date.

// Returns 'N/A'
semverize(new Date("2000-07-05"), null);

Issues

If you have any issues or questions about this module, you can contact me on niels@nybr.be.

Package Sidebar

Install

npm i @nybr.js/semverize

Weekly Downloads

5

Version

1.0.1

License

ISC

Unpacked Size

87.7 kB

Total Files

28

Last publish

Collaborators

  • nielsbril