@searchfe/versions-compare
v1.0.6
Published
[![Build Status](https://travis-ci.org/searchfe/versions-compare.svg?branch=master)](https://travis-ci.org/searchfe/versions-compare) [![Coverage Status](https://coveralls.io/repos/github/searchfe/versions-compare/badge.svg?branch=master)](https://coveral
Downloads
5
Maintainers
Keywords
Readme
Versions Compare 工具
版本对比工具
安装
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('@searchfe/versions-compare')) {
return path.resolve(`${yourPath}/@searchfe/versions-compare/src/index.umd.js`);
}
return null;
}
}],
//...
}
Webpack
module.exports = {
//...
resolve: {
alias: {
"versions-compare": "versions-compare/src/index.umd.js"
}
}
};