hevy-shared 1.0.759 → 1.0.761

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/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,20 @@ 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
+ const feet = Math.floor(totalInches / 12);
34
+ const inches = Math.round(totalInches % 12);
35
+ if (inches === 12) {
36
+ return { ft: feet + 1, in: 0 };
37
+ }
38
+ else {
39
+ return { ft: feet, in: inches };
40
+ }
41
+ };
42
+ exports.roundedCmToFtIn = roundedCmToFtIn;
43
+ const exactFtInToCm = (ftIn) => {
44
+ const totalInches = ftIn.ft * 12 + ftIn.in;
45
+ return Math.round((0, exports.exactInchtoCm)(totalInches));
46
+ };
47
+ exports.exactFtInToCm = exactFtInToCm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.759",
3
+ "version": "1.0.761",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",