pax_global_header00006660000000000000000000000064126216246350014521gustar00rootroot0000000000000052 comment=58205f4b171e86b07942a30fb4502bc0ca60a071 semver-diff-2.1.0/000077500000000000000000000000001262162463500137305ustar00rootroot00000000000000semver-diff-2.1.0/.editorconfig000066400000000000000000000003621262162463500164060ustar00rootroot00000000000000# editorconfig.org root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [package.json] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false semver-diff-2.1.0/.gitattributes000066400000000000000000000000141262162463500166160ustar00rootroot00000000000000* text=auto semver-diff-2.1.0/.gitignore000066400000000000000000000000151262162463500157140ustar00rootroot00000000000000node_modules semver-diff-2.1.0/.jshintrc000066400000000000000000000002761262162463500155620ustar00rootroot00000000000000{ "node": true, "esnext": true, "bitwise": true, "camelcase": true, "curly": true, "immed": true, "newcap": true, "noarg": true, "undef": true, "unused": "vars", "strict": true } semver-diff-2.1.0/.travis.yml000066400000000000000000000001101262162463500160310ustar00rootroot00000000000000sudo: false language: node_js node_js: - 'iojs' - '0.12' - '0.10' semver-diff-2.1.0/index.js000066400000000000000000000007201262162463500153740ustar00rootroot00000000000000'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; }; semver-diff-2.1.0/license000066400000000000000000000021371262162463500153000ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. semver-diff-2.1.0/package.json000066400000000000000000000011621262162463500162160ustar00rootroot00000000000000{ "name": "semver-diff", "version": "2.1.0", "description": "Get the diff type of two semver versions: 0.0.1 0.0.2 → patch", "license": "MIT", "repository": "sindresorhus/semver-diff", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "http://sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "files": [ "index.js" ], "keywords": [ "semver", "version", "semantic", "diff", "difference" ], "dependencies": { "semver": "^5.0.3" }, "devDependencies": { "mocha": "*" } } semver-diff-2.1.0/readme.md000066400000000000000000000020021262162463500155010ustar00rootroot00000000000000# semver-diff [![Build Status](https://travis-ci.org/sindresorhus/semver-diff.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-diff) > Get the diff type of two [semver](https://github.com/isaacs/node-semver) versions: `0.0.1 0.0.2` → `patch` ## Install ```sh $ npm install --save semver-diff ``` ## Usage ```js var semverDiff = require('semver-diff'); semverDiff('1.1.1', '1.1.2'); //=> 'patch' semverDiff('0.0.1', '1.0.0'); //=> 'major' semverDiff('0.0.1', '0.1.0'); //=> 'minor' semverDiff('0.0.1-foo', '0.0.1-foo.bar'); //=> 'prerelease' semverDiff('0.1.0', '0.1.0+foo'); //=> 'build' semverDiff('0.0.1', '0.0.1'); //=> null semverDiff('0.0.2', '0.0.1'); //=> null ``` ## API ### semverDiff(versionA, versionB) Returns the difference type between two semver versions, or `null` if they're identical or the second one is lower than the first. Possible values: `'major'`, `'minor'`, `'patch'`, `'prerelease'`, `'build'`, `null`. ## License MIT © [Sindre Sorhus](http://sindresorhus.com) semver-diff-2.1.0/test.js000066400000000000000000000010761262162463500152510ustar00rootroot00000000000000'use strict'; var assert = require('assert'); var semverDiff = require('./'); it('should get the semver diff type', function () { assert.strictEqual(semverDiff('0.0.1', '1.0.0'), 'major'); assert.strictEqual(semverDiff('0.0.1', '0.1.0'), 'minor'); assert.strictEqual(semverDiff('0.0.1', '0.0.2'), 'patch'); assert.strictEqual(semverDiff('0.0.1-foo', '0.0.1-foo.bar'), 'prerelease'); assert.strictEqual(semverDiff('0.0.1', '0.0.1+foo.bar'), 'build'); assert.strictEqual(semverDiff('0.0.1', '0.0.1'), null); assert.strictEqual(semverDiff('0.0.2', '0.0.1'), null); });