1'use strict'; 2var semver = require('semver'); 3 4module.exports = function (a, b) { 5 if (semver.gt(a, b)) { 6 return null; 7 } 8 9 a = semver.parse(a); 10 b = semver.parse(b); 11 12 for (var key in a) { 13 if (key === 'major' || key === 'minor' || key === 'patch') { 14 if (a[key] !== b[key]) { 15 return key; 16 } 17 } 18 19 if (key === 'prerelease' || key === 'build') { 20 if (JSON.stringify(a[key]) !== JSON.stringify(b[key])) { 21 return key; 22 } 23 } 24 } 25 26 return null; 27}; 28