@fbltd/math 1.0.14 → 1.0.15
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,14 +1,14 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class Point {
|
|
2
2
|
static sum(p1, p2) {
|
|
3
|
-
return [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
static
|
|
9
|
-
return [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
return p1.map((c, i) => c + p2[i]);
|
|
4
|
+
}
|
|
5
|
+
static scale(p, scale) {
|
|
6
|
+
return p.map((c) => c * scale);
|
|
7
|
+
}
|
|
8
|
+
static dif(p1, p2) {
|
|
9
|
+
return p1.map((c, i) => c - p2[i]);
|
|
10
|
+
}
|
|
11
|
+
static abs(p) {
|
|
12
|
+
return p.map(Math.abs);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type IPoint2 = [number, number];
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export type IPoint3 = [number, number, number];
|
|
3
|
+
export type IPoint = IPoint2 | IPoint3;
|
|
4
|
+
export declare class Point {
|
|
5
|
+
static sum<T extends IPoint>(p1: T, p2: T): T;
|
|
6
|
+
static scale<T extends IPoint>(p: T, scale: number): T;
|
|
7
|
+
static dif<T extends IPoint>(p1: T, p2: T): T;
|
|
8
|
+
static abs<T extends IPoint>(p: T): T;
|
|
5
9
|
}
|
|
6
10
|
//# sourceMappingURL=point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/figures/point.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/figures/point.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACtC,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAC9C,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAEtC,qBAAa,KAAK;IACd,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAI7C,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;IAItD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAI7C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC;CAIxC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fbltd/math",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/bin/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"clean": "rm -r dist || echo ''",
|
|
22
22
|
"build": "node_modules/.bin/tsc",
|
|
23
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__
|
|
24
|
+
"test": "npx tsc __tests__/**/*.test.ts --outDir __tests__/dist && npx jest && rm -r __tests__/dist"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|