1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.xor = (targetVal, opts) => {
|
4 | const results = [];
|
5 | const { properties } = opts;
|
6 | if (!targetVal || typeof targetVal !== 'object' || properties.length !== 2)
|
7 | return results;
|
8 | const intersection = Object.keys(targetVal).filter(value => -1 !== properties.indexOf(value));
|
9 | if (intersection.length !== 1) {
|
10 | results.push({
|
11 | message: `${properties[0]} and ${properties[1]} cannot both be defined`,
|
12 | });
|
13 | }
|
14 | return results;
|
15 | };
|
16 |
|
\ | No newline at end of file |