thedesk/app/node_modules/semver-diff/index.js
2019-09-12 23:38:13 +09:00

28 lines
464 B
JavaScript

'use strict';
var semver = require('semver');
module.exports = function (a, b) {
if (semver.gt(a, b)) {
return null;
}
a = semver.parse(a);
b = semver.parse(b);
for (var key in a) {
if (key === 'major' || key === 'minor' || key === 'patch') {
if (a[key] !== b[key]) {
return key;
}
}
if (key === 'prerelease' || key === 'build') {
if (JSON.stringify(a[key]) !== JSON.stringify(b[key])) {
return key;
}
}
}
return null;
};