@augment-vir/core 30.5.1 → 30.6.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,18 @@
1
+ /**
2
+ * @category Number
3
+ * @category Package : @augment-vir/common
4
+ * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
5
+ */
6
+ export type MinMax = {
7
+ min: number;
8
+ max: number;
9
+ };
10
+ /**
11
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
12
+ * that is not the case, values are swapped.
13
+ *
14
+ * @category Number
15
+ * @category Package : @augment-vir/common
16
+ * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
17
+ */
18
+ export declare function ensureMinMax({ min, max }: MinMax): MinMax;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
3
+ * that is not the case, values are swapped.
4
+ *
5
+ * @category Number
6
+ * @category Package : @augment-vir/common
7
+ * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
8
+ */
9
+ export function ensureMinMax({ min, max }) {
10
+ if (min > max) {
11
+ return { min: max, max: min };
12
+ }
13
+ else {
14
+ return { min, max };
15
+ }
16
+ }
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './augments/function/generic-function-type.js';
8
8
  export * from './augments/function/typed-function-type.js';
9
9
  export * from './augments/http/http-status.js';
10
10
  export * from './augments/json/json-compatible.js';
11
+ export * from './augments/min-max.js';
11
12
  export * from './augments/narrow-type.js';
12
13
  export * from './augments/object/generic-object-type.js';
13
14
  export * from './augments/object/object-keys.js';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export * from './augments/function/generic-function-type.js';
8
8
  export * from './augments/function/typed-function-type.js';
9
9
  export * from './augments/http/http-status.js';
10
10
  export * from './augments/json/json-compatible.js';
11
+ export * from './augments/min-max.js';
11
12
  export * from './augments/narrow-type.js';
12
13
  export * from './augments/object/generic-object-type.js';
13
14
  export * from './augments/object/object-keys.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/core",
3
- "version": "30.5.1",
3
+ "version": "30.6.0",
4
4
  "description": "Core augment-vir augments. Use @augment-vir/common instead.",
5
5
  "homepage": "https://github.com/electrovir/augment-vir",
6
6
  "bugs": {