Skip to content

Commit bf20b12

Browse files
committed
added shortcuts to combine as intersection, subtraction, union
1 parent 29bd5d3 commit bf20b12

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/core/combine.ts

+29
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,33 @@
422422
extendObject(options, opts);
423423
}
424424

425+
/**
426+
* Combine 2 models, resulting in a intersection.
427+
*
428+
* @param modelA First model to combine.
429+
* @param modelB Second model to combine.
430+
*/
431+
export function combineIntersection(modelA: IModel, modelB: IModel) {
432+
return combine(modelA, modelB, true, false, true, false);
433+
}
434+
435+
/**
436+
* Combine 2 models, resulting in a subtraction of B from A.
437+
*
438+
* @param modelA First model to combine.
439+
* @param modelB Second model to combine.
440+
*/
441+
export function combineSubtraction(modelA: IModel, modelB: IModel) {
442+
return combine(modelA, modelB, false, true, true, false);
443+
}
444+
445+
/**
446+
* Combine 2 models, resulting in a union.
447+
*
448+
* @param modelA First model to combine.
449+
* @param modelB Second model to combine.
450+
*/
451+
export function combineUnion(modelA: IModel, modelB: IModel) {
452+
return combine(modelA, modelB, false, true, false, true);
453+
}
425454
}

0 commit comments

Comments
 (0)