@augment-vir/common 21.2.0 → 21.3.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toEnsuredNumber = void 0;
|
|
3
|
+
exports.wrapNumber = exports.toEnsuredNumber = void 0;
|
|
4
4
|
function toEnsuredNumber(input) {
|
|
5
5
|
const numeric = Number(input);
|
|
6
6
|
if (isNaN(numeric)) {
|
|
@@ -11,3 +11,13 @@ function toEnsuredNumber(input) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.toEnsuredNumber = toEnsuredNumber;
|
|
14
|
+
function wrapNumber({ max, min, value }) {
|
|
15
|
+
if (value > max) {
|
|
16
|
+
return min;
|
|
17
|
+
}
|
|
18
|
+
else if (value < min) {
|
|
19
|
+
return max;
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
exports.wrapNumber = wrapNumber;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { PartialDeep } from 'type-fest';
|
|
1
2
|
/**
|
|
2
3
|
* Accepts multiple objects and merges their key-value pairs recursively.
|
|
3
4
|
*
|
|
4
5
|
* Note that order matters! Each input object will overwrite the properties of the previous objects.
|
|
5
6
|
*/
|
|
6
|
-
export declare function mergeDeep<T extends object>(...inputs: (T |
|
|
7
|
+
export declare function mergeDeep<T extends object>(...inputs: (T | PartialDeep<T, {
|
|
8
|
+
recurseIntoArrays: true;
|
|
9
|
+
}>)[]): T;
|