Skip to content

Commit

Permalink
fix: export mergebase
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Jul 17, 2024
1 parent 2e4067c commit 61e9a38
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions packages/vutils/__tests__/graphics/intersect.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
isIntersect,
getIntersectPoint,
getRectIntersect,
rectInsideAnotherRect,
isRectIntersect,
pointInRect,
isRotateAABBIntersect
} from '../../src';

describe('intersects', () => {
it('isIntersect', () => {
expect(isIntersect([0, 0], [100, 100], [50, 20], [0, 100])).toBeTruthy();
});

it('getIntersectPoint', () => {
const p = getIntersectPoint([0, 0], [100, 100], [50, 20], [0, 100]);
expect(p[0]).toBeCloseTo(38.46153846153847);
expect(p[1]).toBeCloseTo(38.46153846153847);
});

it('getRectIntersect', () => {
const p = getRectIntersect(
{
x1: 0,
x2: 50,
y1: 0,
y2: 100
},
{
x1: 30,
y1: 30,
x2: 100,
y2: 150
},
true
);
expect(p).toEqual({ x1: 30, x2: 50, y1: 30, y2: 100 });
});
});
2 changes: 1 addition & 1 deletion packages/vutils/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export { default as get } from './get';
export { default as has } from './has';
export { default as clone } from './clone';
export { default as cloneDeep } from './cloneDeep';
export { default as merge } from './merge';
export { default as merge, baseMerge } from './merge';
export { default as pick } from './pick';
export { default as pickWithout } from './pickWithout';
export { isEqual } from './isEqual';
Expand Down
2 changes: 1 addition & 1 deletion packages/vutils/src/common/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import isArrayLike from './isArrayLike';
import isPlainObject from './isPlainObject';
import isValid from './isValid';

function baseMerge(target: any, source: any, shallowArray: boolean = false, skipTargetArray: boolean = false) {
export function baseMerge(target: any, source: any, shallowArray: boolean = false, skipTargetArray: boolean = false) {
if (source) {
if (target === source) {
return;
Expand Down

0 comments on commit 61e9a38

Please sign in to comment.