@jfvilas/kwirth-common 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Version.d.ts +2 -1
- package/dist/Version.js +16 -1
- package/package.json +1 -1
package/dist/Version.d.ts
CHANGED
|
@@ -5,4 +5,5 @@
|
|
|
5
5
|
* @returns true if version1 version is higher than version2
|
|
6
6
|
*/
|
|
7
7
|
declare const versionGreatOrEqualThan: (version1: string, version2: string) => boolean;
|
|
8
|
-
|
|
8
|
+
declare const versionGreatThan: (version1: string, version2: string) => boolean;
|
|
9
|
+
export { versionGreatOrEqualThan, versionGreatThan };
|
package/dist/Version.js
CHANGED
|
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.versionGreatOrEqualThan = void 0;
|
|
18
|
+
exports.versionGreatThan = exports.versionGreatOrEqualThan = void 0;
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
21
|
* @param version1 version to check against a specifi level
|
|
@@ -37,3 +37,18 @@ const versionGreatOrEqualThan = (version1, version2) => {
|
|
|
37
37
|
return true;
|
|
38
38
|
};
|
|
39
39
|
exports.versionGreatOrEqualThan = versionGreatOrEqualThan;
|
|
40
|
+
const versionGreatThan = (version1, version2) => {
|
|
41
|
+
const v1 = version1.split('.').map(Number);
|
|
42
|
+
const v2 = version2.split('.').map(Number);
|
|
43
|
+
for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
|
|
44
|
+
const num1 = v1[i] || 0;
|
|
45
|
+
const num2 = v2[i] || 0;
|
|
46
|
+
if (num1 > num2)
|
|
47
|
+
return true;
|
|
48
|
+
else if (num1 < num2)
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// versions are equal
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
exports.versionGreatThan = versionGreatThan;
|