hevy-shared 1.0.758 → 1.0.760
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/built/typeUtils.d.ts +7 -0
- package/built/typeUtils.js +11 -1
- package/built/units.d.ts +9 -0
- package/built/units.js +11 -1
- package/package.json +1 -1
package/built/typeUtils.d.ts
CHANGED
|
@@ -30,8 +30,15 @@ export type Some<T> = {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
export declare const dangerousUncheckedTypeCast: <T = void, U extends T = T>(value: unknown) => U;
|
|
33
|
+
/**
|
|
34
|
+
* Safer alternative to `JSON.parse`. Returns `unknown` instead of `any`.
|
|
35
|
+
*
|
|
36
|
+
* @see JSON.parse
|
|
37
|
+
*/
|
|
38
|
+
export declare const parseJSON: (...args: Parameters<typeof JSON.parse>) => unknown;
|
|
33
39
|
/**
|
|
34
40
|
* Same as `array[index]`, but adds `undefined` to the return type. Maybe some
|
|
35
41
|
* fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
|
|
36
42
|
*/
|
|
37
43
|
export declare const typeSafeIndex: <T>(array: T[], index: number) => T | undefined;
|
|
44
|
+
export declare const TODO: (message?: string) => never;
|
package/built/typeUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typeSafeIndex = exports.dangerousUncheckedTypeCast = exports.exhaustiveTypeException = exports.exhaustiveTypeCheck = exports.isInArray = void 0;
|
|
3
|
+
exports.TODO = exports.typeSafeIndex = exports.parseJSON = exports.dangerousUncheckedTypeCast = exports.exhaustiveTypeException = exports.exhaustiveTypeCheck = exports.isInArray = void 0;
|
|
4
4
|
const isInArray = (value, array) => array.includes(value);
|
|
5
5
|
exports.isInArray = isInArray;
|
|
6
6
|
const exhaustiveTypeCheck = (_) => void _;
|
|
@@ -30,9 +30,19 @@ exports.exhaustiveTypeException = exhaustiveTypeException;
|
|
|
30
30
|
*/
|
|
31
31
|
const dangerousUncheckedTypeCast = (value) => value;
|
|
32
32
|
exports.dangerousUncheckedTypeCast = dangerousUncheckedTypeCast;
|
|
33
|
+
/**
|
|
34
|
+
* Safer alternative to `JSON.parse`. Returns `unknown` instead of `any`.
|
|
35
|
+
*
|
|
36
|
+
* @see JSON.parse
|
|
37
|
+
*/
|
|
38
|
+
exports.parseJSON = JSON.parse;
|
|
33
39
|
/**
|
|
34
40
|
* Same as `array[index]`, but adds `undefined` to the return type. Maybe some
|
|
35
41
|
* fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
|
|
36
42
|
*/
|
|
37
43
|
const typeSafeIndex = (array, index) => array[index];
|
|
38
44
|
exports.typeSafeIndex = typeSafeIndex;
|
|
45
|
+
const TODO = (message) => {
|
|
46
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Not implemented');
|
|
47
|
+
};
|
|
48
|
+
exports.TODO = TODO;
|
package/built/units.d.ts
CHANGED
|
@@ -7,3 +7,12 @@ export declare const exactInchtoCm: (value: number) => number;
|
|
|
7
7
|
export declare const exactCmtoInch: (value: number) => number;
|
|
8
8
|
export declare const exactMilesToMeters: (value: number) => number;
|
|
9
9
|
export declare const exactMetersToMiles: (meters: number) => number;
|
|
10
|
+
export interface FtIn {
|
|
11
|
+
ft: number;
|
|
12
|
+
in: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const roundedCmToFtIn: (cm: number) => {
|
|
15
|
+
ft: number;
|
|
16
|
+
in: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const exactFtInToCm: (ftIn: FtIn) => number;
|
package/built/units.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exactMetersToMiles = exports.exactMilesToMeters = exports.exactCmtoInch = exports.exactInchtoCm = exports.exactKgtoLbs = exports.exactLbsToKg = exports.METERS_IN_MILE = exports.CM_IN_INCH = exports.POUNDS_IN_KG = void 0;
|
|
3
|
+
exports.exactFtInToCm = exports.roundedCmToFtIn = exports.exactMetersToMiles = exports.exactMilesToMeters = exports.exactCmtoInch = exports.exactInchtoCm = exports.exactKgtoLbs = exports.exactLbsToKg = exports.METERS_IN_MILE = exports.CM_IN_INCH = exports.POUNDS_IN_KG = void 0;
|
|
4
4
|
exports.POUNDS_IN_KG = 2.20462;
|
|
5
5
|
exports.CM_IN_INCH = 2.54;
|
|
6
6
|
exports.METERS_IN_MILE = 1609.34;
|
|
@@ -28,3 +28,13 @@ const exactMetersToMiles = (meters) => {
|
|
|
28
28
|
return meters / exports.METERS_IN_MILE;
|
|
29
29
|
};
|
|
30
30
|
exports.exactMetersToMiles = exactMetersToMiles;
|
|
31
|
+
const roundedCmToFtIn = (cm) => {
|
|
32
|
+
const totalInches = (0, exports.exactCmtoInch)(cm);
|
|
33
|
+
return { ft: Math.floor(totalInches / 12), in: Math.round(totalInches % 12) };
|
|
34
|
+
};
|
|
35
|
+
exports.roundedCmToFtIn = roundedCmToFtIn;
|
|
36
|
+
const exactFtInToCm = (ftIn) => {
|
|
37
|
+
const totalInches = ftIn.ft * 12 + ftIn.in;
|
|
38
|
+
return Math.round((0, exports.exactInchtoCm)(totalInches));
|
|
39
|
+
};
|
|
40
|
+
exports.exactFtInToCm = exactFtInToCm;
|