@fbltd/math 1.0.12 → 1.0.14

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.
Files changed (35) hide show
  1. package/dist/bin/index.js +1 -1
  2. package/dist/bin/src/angle.js +1 -1
  3. package/dist/bin/src/colors/conic.gradient.js +1 -1
  4. package/dist/bin/src/colors/index.js +2 -2
  5. package/dist/bin/src/figures/circle.js +1 -1
  6. package/dist/bin/src/figures/index.js +3 -3
  7. package/dist/bin/src/figures/straight-line.js +1 -1
  8. package/dist/bin/src/index.js +5 -5
  9. package/dist/bin/src/matrix.js +1 -1
  10. package/dist/types/index.d.ts +1 -1
  11. package/dist/types/index.d.ts.map +1 -1
  12. package/dist/types/src/colors/conic.gradient.d.ts +2 -2
  13. package/dist/types/src/colors/conic.gradient.d.ts.map +1 -1
  14. package/dist/types/src/colors/index.d.ts +2 -2
  15. package/dist/types/src/colors/index.d.ts.map +1 -1
  16. package/dist/types/src/figures/circle.d.ts +2 -2
  17. package/dist/types/src/figures/circle.d.ts.map +1 -1
  18. package/dist/types/src/figures/index.d.ts +3 -3
  19. package/dist/types/src/figures/index.d.ts.map +1 -1
  20. package/dist/types/src/figures/straight-line.d.ts +2 -2
  21. package/dist/types/src/figures/straight-line.d.ts.map +1 -1
  22. package/dist/types/src/index.d.ts +5 -5
  23. package/dist/types/src/index.d.ts.map +1 -1
  24. package/dist/types/src/matrix.d.ts +1 -1
  25. package/dist/types/src/matrix.d.ts.map +1 -1
  26. package/package.json +7 -5
  27. package/dist/bin/__tests__/angle.test.js +0 -108
  28. package/dist/bin/__tests__/matrix.test.js +0 -40
  29. package/dist/bin/__tests__/utils.test.js +0 -31
  30. package/dist/types/__tests__/angle.test.d.ts +0 -2
  31. package/dist/types/__tests__/angle.test.d.ts.map +0 -1
  32. package/dist/types/__tests__/matrix.test.d.ts +0 -2
  33. package/dist/types/__tests__/matrix.test.d.ts.map +0 -1
  34. package/dist/types/__tests__/utils.test.d.ts +0 -2
  35. package/dist/types/__tests__/utils.test.d.ts.map +0 -1
package/dist/bin/index.js CHANGED
@@ -1 +1 @@
1
- export * from './src';
1
+ export * from './src/index.js';
@@ -1,4 +1,4 @@
1
- import { isCorrectNumber, toPositive } from "./utils";
1
+ import { isCorrectNumber, toPositive } from "./utils.js";
2
2
  export var AngleUnits;
3
3
  (function (AngleUnits) {
4
4
  AngleUnits[AngleUnits["Deg"] = 0] = "Deg";
@@ -1,4 +1,4 @@
1
- import { Color } from ".";
1
+ import { Color } from "./index.js";
2
2
  export class ConicGradient {
3
3
  colors;
4
4
  constructor(...colors) {
@@ -1,2 +1,2 @@
1
- export * from './color';
2
- export * from './conic.gradient';
1
+ export * from './color.js';
2
+ export * from './conic.gradient.js';
@@ -1,4 +1,4 @@
1
- import { Matrix2d } from "..";
1
+ import { Matrix2d } from "../index.js";
2
2
  export class Circle {
3
3
  center;
4
4
  r;
@@ -1,3 +1,3 @@
1
- export * from './point';
2
- export * from './circle';
3
- export * from './straight-line';
1
+ export * from './point.js';
2
+ export * from './circle.js';
3
+ export * from './straight-line.js';
@@ -1,4 +1,4 @@
1
- import { Matrix2d } from "..";
1
+ import { Matrix2d } from "../index.js";
2
2
  export class StraightLine {
3
3
  p1;
4
4
  p2;
@@ -1,5 +1,5 @@
1
- export * from './angle';
2
- export * from './matrix';
3
- export * from './utils';
4
- export * from './colors';
5
- export * from './figures';
1
+ export * from './angle.js';
2
+ export * from './matrix.js';
3
+ export * from './utils.js';
4
+ export * from './colors/index.js';
5
+ export * from './figures/index.js';
@@ -1,4 +1,4 @@
1
- import { Angle, AngleUnits } from ".";
1
+ import { Angle, AngleUnits } from "./index.js";
2
2
  export const identityMatrix = [1, 0, 0, 1, 0, 0];
3
3
  export function getIdentityMatrix() {
4
4
  return [1, 0, 0, 1, 0, 0];
@@ -1,2 +1,2 @@
1
- export * from './src';
1
+ export * from './src/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -1,5 +1,5 @@
1
- import { Color } from ".";
2
- import type { IPoint2 } from "..";
1
+ import { Color } from "./index.js";
2
+ import type { IPoint2 } from "../index.js";
3
3
  export declare class ConicGradient {
4
4
  colors: {
5
5
  angle: number;
@@ -1 +1 @@
1
- {"version":3,"file":"conic.gradient.d.ts","sourceRoot":"","sources":["../../../../src/colors/conic.gradient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAA;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAEjC,qBAAa,aAAa;IACtB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE,CAAA;gBAE7B,GAAG,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE;IAYxD,eAAe,CAAC,KAAK,EAAE,MAAM;IAuB7B,eAAe,CAAC,KAAK,EAAE,KAAK;IAgC5B,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAOrC,QAAQ,CAAC,GAAG,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO;IAYvD,KAAK;CAYR"}
1
+ {"version":3,"file":"conic.gradient.d.ts","sourceRoot":"","sources":["../../../../src/colors/conic.gradient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,qBAAa,aAAa;IACtB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE,CAAA;gBAE7B,GAAG,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE;IAYxD,eAAe,CAAC,KAAK,EAAE,MAAM;IAuB7B,eAAe,CAAC,KAAK,EAAE,KAAK;IAgC5B,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAOrC,QAAQ,CAAC,GAAG,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO;IAYvD,KAAK;CAYR"}
@@ -1,3 +1,3 @@
1
- export * from './color';
2
- export * from './conic.gradient';
1
+ export * from './color.js';
2
+ export * from './conic.gradient.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/colors/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/colors/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA"}
@@ -1,5 +1,5 @@
1
- import type { IPoint2 } from ".";
2
- import { type IMatrix2d } from "..";
1
+ import type { IPoint2 } from "./index.js";
2
+ import { type IMatrix2d } from "../index.js";
3
3
  export declare class Circle {
4
4
  center: IPoint2;
5
5
  r: number;
@@ -1 +1 @@
1
- {"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../../src/figures/circle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AACjC,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,IAAI,CAAC;AAE9C,qBAAa,MAAM;IACI,MAAM,EAAE,OAAO;IAAS,CAAC,EAAE,MAAM;gBAAjC,MAAM,EAAE,OAAO,EAAS,CAAC,EAAE,MAAM;IAIpD,SAAS,CAAC,MAAM,EAAE,SAAS;CAG9B"}
1
+ {"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../../src/figures/circle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,MAAM;IACI,MAAM,EAAE,OAAO;IAAS,CAAC,EAAE,MAAM;gBAAjC,MAAM,EAAE,OAAO,EAAS,CAAC,EAAE,MAAM;IAIpD,SAAS,CAAC,MAAM,EAAE,SAAS;CAG9B"}
@@ -1,4 +1,4 @@
1
- export * from './point';
2
- export * from './circle';
3
- export * from './straight-line';
1
+ export * from './point.js';
2
+ export * from './circle.js';
3
+ export * from './straight-line.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/figures/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/figures/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA"}
@@ -1,5 +1,5 @@
1
- import type { IPoint2 } from ".";
2
- import { type IMatrix2d } from "..";
1
+ import type { IPoint2 } from "./index.js";
2
+ import { type IMatrix2d } from "../index.js";
3
3
  export declare class StraightLine {
4
4
  p1: IPoint2;
5
5
  p2: IPoint2;
@@ -1 +1 @@
1
- {"version":3,"file":"straight-line.d.ts","sourceRoot":"","sources":["../../../../src/figures/straight-line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAA;AAChC,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,IAAI,CAAA;AAE7C,qBAAa,YAAY;IACF,EAAE,EAAE,OAAO;IAAS,EAAE,EAAE,OAAO;gBAA/B,EAAE,EAAE,OAAO,EAAS,EAAE,EAAE,OAAO;IAIlD,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,UAAQ;CAMrD"}
1
+ {"version":3,"file":"straight-line.d.ts","sourceRoot":"","sources":["../../../../src/figures/straight-line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAEtD,qBAAa,YAAY;IACF,EAAE,EAAE,OAAO;IAAS,EAAE,EAAE,OAAO;gBAA/B,EAAE,EAAE,OAAO,EAAS,EAAE,EAAE,OAAO;IAIlD,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,UAAQ;CAMrD"}
@@ -1,6 +1,6 @@
1
- export * from './angle';
2
- export * from './matrix';
3
- export * from './utils';
4
- export * from './colors';
5
- export * from './figures';
1
+ export * from './angle.js';
2
+ export * from './matrix.js';
3
+ export * from './utils.js';
4
+ export * from './colors/index.js';
5
+ export * from './figures/index.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { AngleUnits, type IPoint2 } from ".";
1
+ import { AngleUnits, type IPoint2 } from "./index.js";
2
2
  export type IMatrix2d = [
3
3
  number,
4
4
  number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AG,SAAS;IAI/D,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,aAAiB,GAAG,SAAS;IAOvE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,aAAiB,GAAG,SAAS;IAI7E,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAE,MAAU,GAAG,SAAS;IAI7D,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAE,MAAU,GAAG,SAAS;IAInE,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS;IAIrD,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS;IAIrD,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,aAAiB,GAAG,SAAS;IAQ5E,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,aAAiB,GAAG,SAAS;IAIxE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,aAAiB,GAAG,SAAS;IAIxE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,SAAI,EAAE,KAAK,aAAiB,GAAG,SAAS;CAGjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fbltd/math",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "",
5
5
  "main": "dist/bin/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -20,9 +20,8 @@
20
20
  "start": "node_modules/.bin/tsc --watch --noEmit",
21
21
  "clean": "rm -r dist || echo ''",
22
22
  "build": "node_modules/.bin/tsc",
23
- "deploy": "npm run clean && npm run build && npm version patch && git push && npm publish && npm run clean",
24
- "make": "node_modules/.bin/fbltd_make",
25
- "test": "node_modules/.bin/fbltd_test"
23
+ "deploy": "npm run clean && npm run build && npm run test && npm version patch && git push && npm publish && npm run clean",
24
+ "test": "npx tsc __tests__/*.test.ts --outDir __tests__/dist && npx jest && rm -r __tests__/dist"
26
25
  },
27
26
  "repository": {
28
27
  "type": "git",
@@ -38,6 +37,9 @@
38
37
  "access": "public"
39
38
  },
40
39
  "devDependencies": {
41
- "@fbltd/bundler": "^2.0.46"
40
+ "@types/jest": "^29.5.13",
41
+ "@types/node": "^22.7.4",
42
+ "jest": "^29.7.0",
43
+ "typescript": "^5.6.2"
42
44
  }
43
45
  }
@@ -1,108 +0,0 @@
1
- import { Angle, AngleUnits, approximately } from "../src";
2
- describe('math.angle.toDeg', () => {
3
- test('from Turn', () => {
4
- expect(Angle.toDeg(1, AngleUnits.Turn)).toBe(360);
5
- expect(Angle.toDeg(0, AngleUnits.Turn)).toBe(0);
6
- expect(Angle.toDeg(0.5, AngleUnits.Turn)).toBe(180);
7
- expect(Angle.toDeg(-0.5, AngleUnits.Turn)).toBe(-180);
8
- });
9
- test('from Rad', () => {
10
- expect(Angle.toDeg(Math.PI * 2, AngleUnits.Rad)).toBe(360);
11
- expect(Angle.toDeg(0, AngleUnits.Rad)).toBe(0);
12
- expect(Angle.toDeg(Math.PI, AngleUnits.Rad)).toBe(180);
13
- expect(Angle.toDeg(-Math.PI, AngleUnits.Rad)).toBe(-180);
14
- });
15
- test('from Deg', () => {
16
- expect(Angle.toDeg(180, AngleUnits.Deg)).toBe(180);
17
- });
18
- });
19
- describe('math.angle.toRad', () => {
20
- test('from Rad', () => {
21
- expect(Angle.toRad(1, AngleUnits.Rad)).toBe(1);
22
- });
23
- test('from Deg', () => {
24
- expect(Angle.toRad(360, AngleUnits.Deg)).toBe(Math.PI * 2);
25
- expect(Angle.toRad(0, AngleUnits.Deg)).toBe(0);
26
- expect(Angle.toRad(180, AngleUnits.Deg)).toBe(Math.PI);
27
- expect(Angle.toRad(-180, AngleUnits.Deg)).toBe(-Math.PI);
28
- });
29
- test('from Turn', () => {
30
- expect(Angle.toRad(1, AngleUnits.Turn)).toBe(Math.PI * 2);
31
- expect(Angle.toRad(0, AngleUnits.Turn)).toBe(0);
32
- expect(Angle.toRad(0.5, AngleUnits.Turn)).toBe(Math.PI);
33
- expect(Angle.toRad(-0.5, AngleUnits.Turn)).toBe(-Math.PI);
34
- });
35
- });
36
- describe('math.angle.toTurn', () => {
37
- test('from Turn', () => {
38
- expect(Angle.toTurn(0.1, AngleUnits.Turn)).toBe(0.1);
39
- });
40
- test('from Deg', () => {
41
- expect(Angle.toTurn(360, AngleUnits.Deg)).toBe(1);
42
- expect(Angle.toTurn(0, AngleUnits.Deg)).toBe(0);
43
- expect(Angle.toTurn(180, AngleUnits.Deg)).toBe(0.5);
44
- expect(Angle.toTurn(-180, AngleUnits.Deg)).toBe(-0.5);
45
- });
46
- test('from Rad', () => {
47
- expect(Angle.toTurn(Math.PI * 2, AngleUnits.Rad)).toBe(1);
48
- expect(Angle.toTurn(0, AngleUnits.Rad)).toBe(0);
49
- expect(Angle.toTurn(Math.PI, AngleUnits.Rad)).toBe(0.5);
50
- expect(Angle.toTurn(-Math.PI, AngleUnits.Rad)).toBe(-0.5);
51
- });
52
- });
53
- describe('math.angle.toPositive', () => {
54
- test('deg', () => {
55
- expect(Angle.toPositive(0, AngleUnits.Deg)).toBe(0);
56
- expect(Angle.toPositive(-0, AngleUnits.Deg)).toBe(0);
57
- expect(Angle.toPositive(-721, AngleUnits.Deg)).toBe(359);
58
- expect(Angle.toPositive(361, AngleUnits.Deg)).toBe(361);
59
- });
60
- test('rad', () => {
61
- expect(Angle.toPositive(0, AngleUnits.Rad)).toBe(0);
62
- expect(Angle.toPositive(-0, AngleUnits.Rad)).toBe(0);
63
- expect(Angle.toPositive(-Math.PI, AngleUnits.Rad)).toBe(Math.PI);
64
- expect(Angle.toPositive(-(Math.PI * 3), AngleUnits.Rad)).toBe(Math.PI);
65
- });
66
- test('turn', () => {
67
- expect(Angle.toPositive(0, AngleUnits.Turn)).toBe(0);
68
- expect(Angle.toPositive(-0, AngleUnits.Turn)).toBe(0);
69
- expect(approximately(Angle.toPositive(-1.1, AngleUnits.Turn), 0.9)).toBe(true);
70
- expect(Angle.toPositive(1.1, AngleUnits.Turn)).toBe(1.1);
71
- });
72
- });
73
- describe('math.angle.normalize', () => {
74
- test('deg', () => {
75
- expect(Angle.normalize(0, AngleUnits.Deg)).toBe(0);
76
- expect(Angle.normalize(-0, AngleUnits.Deg)).toBe(0);
77
- expect(Angle.normalize(-721, AngleUnits.Deg)).toBe(359);
78
- expect(Angle.normalize(721, AngleUnits.Deg)).toBe(1);
79
- expect(Angle.normalize(361, AngleUnits.Deg)).toBe(1);
80
- expect(Angle.normalize(360, AngleUnits.Deg)).toBe(0);
81
- expect(Angle.normalize(-360, AngleUnits.Deg)).toBe(0);
82
- });
83
- test('rad', () => {
84
- expect(Angle.normalize(0, AngleUnits.Rad)).toBe(0);
85
- expect(Angle.normalize(-0, AngleUnits.Rad)).toBe(0);
86
- expect(Angle.normalize(-(Math.PI * 3), AngleUnits.Rad)).toBe(Math.PI);
87
- expect(Angle.normalize(Math.PI * 3, AngleUnits.Rad)).toBe(Math.PI);
88
- expect(approximately(Angle.normalize(Math.PI * 2 + 0.01, AngleUnits.Rad), 0.01)).toBe(true);
89
- expect(Angle.normalize(Math.PI * 2, AngleUnits.Rad)).toBe(0);
90
- expect(Angle.normalize(-Math.PI * 2, AngleUnits.Rad)).toBe(0);
91
- });
92
- test('turn', () => {
93
- });
94
- });
95
- describe('math.angle.toCSS', () => {
96
- expect(Angle.toCSS(1, AngleUnits.Deg)).toEqual('rotate(1deg)');
97
- expect(Angle.toCSS(1, AngleUnits.Rad)).toEqual('rotate(1rad)');
98
- expect(Angle.toCSS(1, AngleUnits.Turn)).toEqual('rotate(1turn)');
99
- expect(Angle.toCSS(-1, AngleUnits.Deg)).toEqual('rotate(-1deg)');
100
- expect(Angle.toCSS(-1, AngleUnits.Rad)).toEqual('rotate(-1rad)');
101
- expect(Angle.toCSS(-1, AngleUnits.Turn)).toEqual('rotate(-1turn)');
102
- expect(Angle.toCSS(NaN, AngleUnits.Deg)).toEqual('');
103
- expect(Angle.toCSS(Infinity, AngleUnits.Rad)).toEqual('');
104
- expect(Angle.toCSS(-Infinity, AngleUnits.Turn)).toEqual('');
105
- expect(Angle.toCSS('1e -08', AngleUnits.Deg)).toEqual('');
106
- expect(Angle.toCSS(undefined, AngleUnits.Deg)).toEqual('');
107
- expect(Angle.toCSS(null, AngleUnits.Deg)).toEqual('');
108
- });
@@ -1,40 +0,0 @@
1
- import { approximately, identityMatrix, Matrix2d } from "..";
2
- describe('Matrix', () => {
3
- let matrix;
4
- test('should be the same', () => {
5
- matrix = identityMatrix;
6
- matrix = Matrix2d.multiply(matrix, identityMatrix);
7
- expect(matrix).toEqual(identityMatrix);
8
- expect(matrix).not.toBe(identityMatrix);
9
- });
10
- test('transform', () => {
11
- matrix = identityMatrix;
12
- matrix = Matrix2d.translate(matrix, 10);
13
- expect(matrix).toEqual([1, 0, 0, 1, 10, 0]);
14
- matrix = Matrix2d.translate(matrix, 10);
15
- expect(matrix).not.toEqual([1, 0, 0, 1, 10, 0]);
16
- expect(matrix[4]).toBe(20);
17
- matrix = Matrix2d.translate(matrix, 0, 1);
18
- expect(matrix[4]).toBe(20);
19
- expect(matrix[5]).toBe(1);
20
- matrix = Matrix2d.scale(matrix, 2);
21
- expect(matrix[0]).toBe(2);
22
- expect(matrix[1]).toBe(0);
23
- expect(matrix[2]).toBe(0);
24
- expect(matrix[3]).toBe(2);
25
- expect(matrix[4]).toBe(20);
26
- expect(matrix[5]).toBe(1);
27
- matrix = Matrix2d.rotate(matrix, 90);
28
- expect(approximately(matrix[0], 0)).toBe(true);
29
- expect(approximately(matrix[1], 2)).toBe(true);
30
- expect(approximately(matrix[2], -2)).toBe(true);
31
- expect(approximately(matrix[3], 0)).toBe(true);
32
- expect(approximately(matrix[4], 20)).toBe(true);
33
- expect(approximately(matrix[5], 1)).toBe(true);
34
- matrix = Matrix2d.rotateIdentity(45);
35
- expect(approximately(matrix[0], matrix[1])).toBe(true);
36
- expect(approximately(matrix[2], -matrix[3])).toBe(true);
37
- matrix = Matrix2d.skewIdentity(-45, 0);
38
- expect(approximately(matrix[3], 1)).toBe(true);
39
- });
40
- });
@@ -1,31 +0,0 @@
1
- import { approximately, isCorrectNumber, toPositive } from "../src";
2
- test('approximately', () => {
3
- expect(approximately(0, 0)).toBe(true);
4
- expect(approximately(1 + 1e-8, 1)).toBe(true);
5
- expect(approximately(-1 - 1e-8, -1)).toBe(true);
6
- expect(approximately(1 + 1e-8 + 1e-9, 1)).toBe(false);
7
- expect(approximately(-1 - 1e-8 - 1e-9, -1)).toBe(false);
8
- expect(approximately(0, 0.1)).toBe(false);
9
- expect(approximately(0, 0.1, 0.1)).toBe(true);
10
- });
11
- test('toPositive', () => {
12
- expect(toPositive(-1, 360)).toEqual(359);
13
- expect(toPositive(1, 360)).toEqual(1);
14
- expect(toPositive(0, 1)).toEqual(0);
15
- expect(toPositive(-720, 360)).toEqual(0);
16
- expect(toPositive(-721, 360)).toEqual(359);
17
- expect(toPositive(-0, 0)).toEqual(0);
18
- });
19
- test('isCorrectNumber', () => {
20
- expect(isCorrectNumber(0)).toBe(true);
21
- expect(isCorrectNumber('0')).toBe(true);
22
- expect(isCorrectNumber('0e-08')).toBe(true);
23
- expect(isCorrectNumber('0e -08')).toBe(false);
24
- expect(isCorrectNumber({ 1: 2 })).toBe(false);
25
- expect(isCorrectNumber(null)).toBe(false);
26
- expect(isCorrectNumber(undefined)).toBe(false);
27
- expect(isCorrectNumber(Infinity)).toBe(false);
28
- expect(isCorrectNumber(-Infinity)).toBe(false);
29
- expect(isCorrectNumber(NaN)).toBe(false);
30
- expect(isCorrectNumber('')).toBe(false);
31
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=angle.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"angle.test.d.ts","sourceRoot":"","sources":["../../../__tests__/angle.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=matrix.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matrix.test.d.ts","sourceRoot":"","sources":["../../../__tests__/matrix.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../__tests__/utils.test.ts"],"names":[],"mappings":""}