How to use the semver-parser.parseSemVer function in semver-parser

To help you get started, we’ve selected a few semver-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ElasticHQ / elasticsearch-HQ / ui / src / components / footer / footer.controller.js View on Github external
this.installed_version = this.dataSet.installed_version;

        let latestStable = this.dataSet.current_stable_version;
        // For Testing
        //latestStable = "2.8.0"; //-beta.30";


        let html = '';
        // See https://github.com/asamuzaK/semverParser
        //  for details available 
        let outcome = compareSemVer(latestStable, this.installed_version)

        if (!!outcome) {
            // See if difference is simple a Patch, or something larger
            let latest = parseSemVer(latestStable);
            let installed = parseSemVer(this.installed_version);

            html = `Installed Version: <b>${this.installed_version}</b>. Latest version: `;
            if (latest.major &gt; installed.major) {
                html += `<span class="alert alert-danger mini-alert">${latestStable}</span>`
            } else if (latest.minor &gt; installed.minor) {
                html += `<span class="alert alert-danger mini-alert">${latestStable}</span>`
            } else if (latest.patch &gt; installed.patch) {
                html += `<span class="alert alert-warning mini-alert">${latestStable}</span>`
            } else {
                // This would normally be beta releases
                html += `<span class="alert alert-info mini-alert">${latestStable}</span>`
            }
            html += '<br><b>Consider upgrading!</b>'

        } else {
            html = `You are on the current version: <span class="alert alert-success mini-alert">${this.installed_version}</span>`
github ElasticHQ / elasticsearch-HQ / ui / src / components / footer / footer.controller.js View on Github external
parseVersions() {
        this.installed_version = this.dataSet.installed_version;

        let latestStable = this.dataSet.current_stable_version;
        // For Testing
        //latestStable = "2.8.0"; //-beta.30";


        let html = '';
        // See https://github.com/asamuzaK/semverParser
        //  for details available 
        let outcome = compareSemVer(latestStable, this.installed_version)

        if (!!outcome) {
            // See if difference is simple a Patch, or something larger
            let latest = parseSemVer(latestStable);
            let installed = parseSemVer(this.installed_version);

            html = `Installed Version: <b>${this.installed_version}</b>. Latest version: `;
            if (latest.major &gt; installed.major) {
                html += `<span class="alert alert-danger mini-alert">${latestStable}</span>`
            } else if (latest.minor &gt; installed.minor) {
                html += `<span class="alert alert-danger mini-alert">${latestStable}</span>`
            } else if (latest.patch &gt; installed.patch) {
                html += `<span class="alert alert-warning mini-alert">${latestStable}</span>`
            } else {
                // This would normally be beta releases
                html += `<span class="alert alert-info mini-alert">${latestStable}</span>`
            }
            html += '<br><b>Consider upgrading!</b>'

        } else {

semver-parser

SemVer parser. parse, verify, compare SemVer.

MIT
Latest version published 26 days ago

Package Health Score

67 / 100
Full package analysis

Similar packages