Skip to content

searchfe/versions-compare

Repository files navigation

Versions Compare 工具

Build Status Coverage Status

版本对比工具

安装

npm install --save versions-compare

例子

var compare = require('versions-compare');

compare(1, 2); // -1
compare([1, 2], [1, 3]); // -1
compare('1.2.3', '1.4.1'); // -1
compare('1.1.1', '1.1.1'); // 0
compare('1.2.3', [1, 2, 3]); // 0
compare('1.2', 2); // -1
compare(3, [2, 3, 4]); // -1
compare('1.0.1', '1'); // 1
compare('1.1.', [1, 2, 3]); // Wrong Params.
compare('.1.1', [1, 2, 3]); // Wrong Params.

UMD 版本引入

Rollup

import path from 'path';

export default {
    //...
    plugins: [{
        resolveId(id) {
            if (id.startsWith('versions-compare')) {
                return path.resolve(`${yourPath}/versions-compare/src/index.umd.js`);
            }
            return null;
        }
    }],
    //...
}

Webpack

module.exports = {
    //...
    resolve: {
        alias: {
            "versions-compare": "versions-compare/src/index.umd.js"
        }
    }
};

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published