Skip to content

Instantly share code, notes, and snippets.

View yeganemehr's full-sized avatar
👋
Let's Do It

Amir H. Yeganemehr yeganemehr

👋
Let's Do It
View GitHub Profile
@yeganemehr
yeganemehr / semanticVersioningConversion.js
Last active March 6, 2023 00:41 — forked from dislick/semanticVersioningConversion.js
Convert Semantic Versioning String to Integer in ES6
/**
* Convert a sematic versioning string into an 32-bit integer.
*
* Make sure the input string is compatible with the standard found
* at semver.org. Since this only uses 10-bit per major/minor/patch version,
* the highest possible SemVer string would be 1023.1023.1023.
* @param {string} version SemVer string
* @return {number} Numeric version
*/
const convertVersionToInt32 = function(version) {