flo-mat 4.1.0 → 4.1.1
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/__tests__/helpers/jest.setup.ts +35 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +1 -1
- package/browser/index.js +10511 -10224
- package/browser/index.min.js +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
- package/node/find-mat/find-mats.js +3 -1
- package/node/find-mat/find-mats.js.map +1 -1
- package/package.json +14 -14
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +0 -1
- package/src/find-mat/find-mats.ts +3 -1
- package/src/debug/functions/draw/draw-bezier-pieces.ts +0 -35
|
@@ -2,5 +2,40 @@ import { expect } from '@jest/globals';
|
|
|
2
2
|
import { nearly } from './jest-extend-nearly.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
// Polyfill for the TC39 `Map.prototype.getOrInsert` / `getOrInsertComputed`
|
|
6
|
+
// proposal, not yet available in the Node runtime Jest runs on (used by flo-boolean).
|
|
7
|
+
// See: https://github.com/tc39/proposal-upsert
|
|
8
|
+
if (typeof (Map.prototype as any).getOrInsert !== 'function') {
|
|
9
|
+
Object.defineProperty(Map.prototype, 'getOrInsert', {
|
|
10
|
+
value: function getOrInsert(this: Map<unknown, unknown>, key: unknown, defaultValue: unknown) {
|
|
11
|
+
if (this.has(key)) {
|
|
12
|
+
return this.get(key);
|
|
13
|
+
}
|
|
14
|
+
this.set(key, defaultValue);
|
|
15
|
+
return defaultValue;
|
|
16
|
+
},
|
|
17
|
+
writable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
enumerable: false,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (typeof (Map.prototype as any).getOrInsertComputed !== 'function') {
|
|
24
|
+
Object.defineProperty(Map.prototype, 'getOrInsertComputed', {
|
|
25
|
+
value: function getOrInsertComputed(this: Map<unknown, unknown>, key: unknown, callbackFn: (key: unknown) => unknown) {
|
|
26
|
+
if (this.has(key)) {
|
|
27
|
+
return this.get(key);
|
|
28
|
+
}
|
|
29
|
+
const value = callbackFn(key);
|
|
30
|
+
this.set(key, value);
|
|
31
|
+
return value;
|
|
32
|
+
},
|
|
33
|
+
writable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
enumerable: false,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
5
40
|
// Register custom matchers globally for all test files.
|
|
6
41
|
expect.extend(nearly);
|
|
@@ -100,7 +100,7 @@ test('Should correctly reconstruct original shape from medial axis for specific
|
|
|
100
100
|
|
|
101
101
|
const bezierLoops = getPathsFromStr(pathStr);
|
|
102
102
|
|
|
103
|
-
const loopss = simplifyPaths(bezierLoops,
|
|
103
|
+
const loopss = simplifyPaths(bezierLoops, { forceOrientationNegative: true });
|
|
104
104
|
|
|
105
105
|
let mats: Mat[];
|
|
106
106
|
try {
|