@augment-vir/common 12.14.0 → 13.0.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.
@@ -12,4 +12,15 @@ export declare function clamp(
12
12
  }): number;
13
13
  export declare function convertIntoNumber(input: unknown): number;
14
14
  export declare function doesRequireScientificNotation(input: number): boolean;
15
+ /**
16
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
17
+ * that is not the case, the returned value is the given min and max values swapped.
18
+ */
19
+ export declare function ensureMinAndMax({ min, max }: {
20
+ min: number;
21
+ max: number;
22
+ }): {
23
+ min: number;
24
+ max: number;
25
+ };
15
26
  //# sourceMappingURL=common-number.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doesRequireScientificNotation = exports.convertIntoNumber = exports.clamp = exports.addCommasToNumber = exports.NaNString = void 0;
3
+ exports.ensureMinAndMax = exports.doesRequireScientificNotation = exports.convertIntoNumber = exports.clamp = exports.addCommasToNumber = exports.NaNString = void 0;
4
4
  const common_string_1 = require("./common-string");
5
5
  const regexp_1 = require("./regexp");
6
6
  exports.NaNString = String(NaN);
@@ -43,3 +43,16 @@ function doesRequireScientificNotation(input) {
43
43
  return String(input).includes('e');
44
44
  }
45
45
  exports.doesRequireScientificNotation = doesRequireScientificNotation;
46
+ /**
47
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
48
+ * that is not the case, the returned value is the given min and max values swapped.
49
+ */
50
+ function ensureMinAndMax({ min, max }) {
51
+ if (min > max) {
52
+ return { min: max, max: min };
53
+ }
54
+ else {
55
+ return { min, max };
56
+ }
57
+ }
58
+ exports.ensureMinAndMax = ensureMinAndMax;
@@ -0,0 +1,2 @@
1
+ export declare function isUuid(maybeUuid: string): boolean;
2
+ //# sourceMappingURL=uuid.d.ts.map
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUuid = void 0;
4
+ const uuidRegExp = /[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}/;
5
+ function isUuid(maybeUuid) {
6
+ return !!maybeUuid.match(uuidRegExp);
7
+ }
8
+ exports.isUuid = isUuid;
@@ -23,6 +23,7 @@ export * from './augments/promise';
23
23
  export * from './augments/regexp';
24
24
  export * from './augments/runtime-type-of';
25
25
  export * from './augments/string/url';
26
+ export * from './augments/string/uuid';
26
27
  export * from './augments/truncate-number';
27
28
  export * from './augments/tuple';
28
29
  export * from './augments/type';
package/dist/cjs/index.js CHANGED
@@ -39,6 +39,7 @@ __exportStar(require("./augments/promise"), exports);
39
39
  __exportStar(require("./augments/regexp"), exports);
40
40
  __exportStar(require("./augments/runtime-type-of"), exports);
41
41
  __exportStar(require("./augments/string/url"), exports);
42
+ __exportStar(require("./augments/string/uuid"), exports);
42
43
  __exportStar(require("./augments/truncate-number"), exports);
43
44
  __exportStar(require("./augments/tuple"), exports);
44
45
  __exportStar(require("./augments/type"), exports);
@@ -12,4 +12,15 @@ export declare function clamp(
12
12
  }): number;
13
13
  export declare function convertIntoNumber(input: unknown): number;
14
14
  export declare function doesRequireScientificNotation(input: number): boolean;
15
+ /**
16
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
17
+ * that is not the case, the returned value is the given min and max values swapped.
18
+ */
19
+ export declare function ensureMinAndMax({ min, max }: {
20
+ min: number;
21
+ max: number;
22
+ }): {
23
+ min: number;
24
+ max: number;
25
+ };
15
26
  //# sourceMappingURL=common-number.d.ts.map
@@ -36,3 +36,15 @@ export function convertIntoNumber(input) {
36
36
  export function doesRequireScientificNotation(input) {
37
37
  return String(input).includes('e');
38
38
  }
39
+ /**
40
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
41
+ * that is not the case, the returned value is the given min and max values swapped.
42
+ */
43
+ export function ensureMinAndMax({ min, max }) {
44
+ if (min > max) {
45
+ return { min: max, max: min };
46
+ }
47
+ else {
48
+ return { min, max };
49
+ }
50
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isUuid(maybeUuid: string): boolean;
2
+ //# sourceMappingURL=uuid.d.ts.map
@@ -0,0 +1,4 @@
1
+ const uuidRegExp = /[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}/;
2
+ export function isUuid(maybeUuid) {
3
+ return !!maybeUuid.match(uuidRegExp);
4
+ }
@@ -23,6 +23,7 @@ export * from './augments/promise';
23
23
  export * from './augments/regexp';
24
24
  export * from './augments/runtime-type-of';
25
25
  export * from './augments/string/url';
26
+ export * from './augments/string/uuid';
26
27
  export * from './augments/truncate-number';
27
28
  export * from './augments/tuple';
28
29
  export * from './augments/type';
package/dist/esm/index.js CHANGED
@@ -23,6 +23,7 @@ export * from './augments/promise';
23
23
  export * from './augments/regexp';
24
24
  export * from './augments/runtime-type-of';
25
25
  export * from './augments/string/url';
26
+ export * from './augments/string/uuid';
26
27
  export * from './augments/truncate-number';
27
28
  export * from './augments/tuple';
28
29
  export * from './augments/type';
@@ -12,4 +12,15 @@ export declare function clamp(
12
12
  }): number;
13
13
  export declare function convertIntoNumber(input: unknown): number;
14
14
  export declare function doesRequireScientificNotation(input: number): boolean;
15
+ /**
16
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
17
+ * that is not the case, the returned value is the given min and max values swapped.
18
+ */
19
+ export declare function ensureMinAndMax({ min, max }: {
20
+ min: number;
21
+ max: number;
22
+ }): {
23
+ min: number;
24
+ max: number;
25
+ };
15
26
  //# sourceMappingURL=common-number.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function isUuid(maybeUuid: string): boolean;
2
+ //# sourceMappingURL=uuid.d.ts.map
@@ -23,6 +23,7 @@ export * from './augments/promise';
23
23
  export * from './augments/regexp';
24
24
  export * from './augments/runtime-type-of';
25
25
  export * from './augments/string/url';
26
+ export * from './augments/string/uuid';
26
27
  export * from './augments/truncate-number';
27
28
  export * from './augments/tuple';
28
29
  export * from './augments/type';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "12.14.0",
3
+ "version": "13.0.0",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"