@configura/web-utilities 1.6.1 → 2.0.0-alpha.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.
@@ -1,3 +1,4 @@
1
1
  export declare function degToRad(deg: number): number;
2
2
  export declare function radToDeg(rad: number): number;
3
+ export declare function normalizeAngle(angle: number): number;
3
4
  //# sourceMappingURL=utilitiesMath.d.ts.map
@@ -4,3 +4,6 @@ export function degToRad(deg) {
4
4
  export function radToDeg(rad) {
5
5
  return (rad * 180) / Math.PI;
6
6
  }
7
+ export function normalizeAngle(angle) {
8
+ return Math.atan2(Math.sin(angle), Math.cos(angle));
9
+ }
@@ -1,4 +1,9 @@
1
1
  export declare type LengthUnit = "mm" | "cm" | "dm" | "m" | "in" | "ft";
2
+ export declare type LengthValue = {
3
+ length: number;
4
+ unit: LengthUnit;
5
+ };
6
+ export declare const isEqualLength: (l: LengthValue, r: LengthValue) => boolean;
2
7
  /**
3
8
  * Converts string to LengthUnit.
4
9
  * @throws an error if the supplied string isn't a known length unit
@@ -3,6 +3,7 @@ const metricUnits = ["mm", "cm", "dm", "m"];
3
3
  const meterPerInch = 0.0254;
4
4
  const inchPerFeet = 12;
5
5
  const meterPerFeet = meterPerInch * inchPerFeet;
6
+ export const isEqualLength = (l, r) => l.length === convertLength(r.length, r.unit, l.unit);
6
7
  /**
7
8
  * Converts string to LengthUnit.
8
9
  * @throws an error if the supplied string isn't a known length unit
@@ -32,6 +33,9 @@ export function isLengthUnit(unit) {
32
33
  unit === "ft");
33
34
  }
34
35
  export function convertLength(l, from, to) {
36
+ if (from === to) {
37
+ return l;
38
+ }
35
39
  if (from === "ft" && to === "in") {
36
40
  return l * inchPerFeet;
37
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-utilities",
3
- "version": "1.6.1",
3
+ "version": "2.0.0-alpha.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,5 +22,5 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "gitHead": "bffef8762f32d8629a89837cafc20d34702409a3"
25
+ "gitHead": "b802ecc481c41f8dd8342dc6eaf5010a86f0f85d"
26
26
  }