utils.checkVersion

checkVersion(first: string, second: string) → {number}

Compare two version strings

if (me.utils.checkVersion("7.0.0") > 0) {
    console.error(
        "melonJS is too old. Expected: 7.0.0, Got: 6.3.0"
    );
}
Parameters:
Name Type Description
first string

First version string to compare

second string

second version string to compare

Returns:
Type Description
number

comparison result
< 0 : first < second
0 : first == second
> 0 : first > second

Powered by webdoc!