diff --git a/util/minecraftVersionToNumber.js b/util/minecraftVersionToNumber.js new file mode 100644 index 0000000..d0ab94e --- /dev/null +++ b/util/minecraftVersionToNumber.js @@ -0,0 +1,12 @@ +/** + * converts minecraft version to number (for example '1.19.2' will be 1.19) + * @param {String} version + * @return {Number} decimal number of the version you specified + */ +function minecraftVersionToNumber (version) { + const versionArray = version.split('.') + versionArray.pop() + return Number(versionArray.join('.')) +} + +module.exports = minecraftVersionToNumber