.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / semver-diff / index.js
1 'use strict';
2 var semver = require('semver');
3
4 module.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 };