UNPKG

usedjs

Version:

used.js 是一个轻量级小巧的可运行在浏览器中的 JavaScript 函数库

24 lines (23 loc) 676 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function compareVersion(oldVersion, newVersion, containEqual) { if (containEqual === void 0) { containEqual = true; } if (typeof oldVersion !== "string" || typeof newVersion !== "string") { return false; } var oldArray = oldVersion.split("."); var newArray = newVersion.split("."); var o; var n; do { o = oldArray.shift(); n = newArray.shift(); } while (o === n && newArray.length > 0); if (containEqual) { return (n | 0) >= (o | 0); } else { return (n | 0) > (o | 0); } } exports.default = compareVersion;