@ancon/wildcat-utils 1.3.0 → 1.4.0

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.
@@ -0,0 +1 @@
1
+ export default function cleanVersionString(version: string): string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function cleanVersionString(version) {
4
+ // Transform to lowercase
5
+ const lowercase = version.toLowerCase();
6
+ // Remove anything after `-` for example -beta.2
7
+ const versionPart = lowercase.split('-')[0];
8
+ // Remove starting `v` if needed
9
+ const removedV = versionPart.charAt(0) === 'v' ? versionPart.substring(1) : versionPart;
10
+ return removedV;
11
+ }
12
+ exports.default = cleanVersionString;
@@ -1 +1,2 @@
1
1
  export { default as isVersionALessThanB } from './isVersionALessThanB';
2
+ export { default as cleanVersionString } from './cleanVersionString';
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isVersionALessThanB = void 0;
6
+ exports.cleanVersionString = exports.isVersionALessThanB = void 0;
7
7
  var isVersionALessThanB_1 = require("./isVersionALessThanB");
8
8
  Object.defineProperty(exports, "isVersionALessThanB", { enumerable: true, get: function () { return __importDefault(isVersionALessThanB_1).default; } });
9
+ var cleanVersionString_1 = require("./cleanVersionString");
10
+ Object.defineProperty(exports, "cleanVersionString", { enumerable: true, get: function () { return __importDefault(cleanVersionString_1).default; } });
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const compare_versions_1 = __importDefault(require("compare-versions"));
7
+ const cleanVersionString_1 = __importDefault(require("./cleanVersionString"));
7
8
  function isVersionALessThanB(versionA, versionB) {
8
- var _a;
9
- return compare_versions_1.default.compare((_a = versionA.split('-')) === null || _a === void 0 ? void 0 : _a[0], versionB, '<');
9
+ const cleanedVersionA = (0, cleanVersionString_1.default)(versionA);
10
+ const cleanedVersionB = (0, cleanVersionString_1.default)(versionB);
11
+ return compare_versions_1.default.compare(cleanedVersionA, cleanedVersionB, '<');
10
12
  }
11
13
  exports.default = isVersionALessThanB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "repository": "git@bitbucket.org:anconab/wildcat.utils.git",
6
6
  "main": "dist/index.js",