rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
26 lines • 680 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapSymmetricDifference = void 0;
/**
* @public
* Returns a map with keys in A not in B, and keys in B not in A.
*
* @remarks
* See {@link mapSymmetricDifference}.
*/
function mapSymmetricDifference(a, b) {
const result = new Map();
a.forEach((item, key) => {
if (!b.has(key)) {
result.set(key, item);
}
});
b.forEach((item, key) => {
if (!a.has(key)) {
result.set(key, item);
}
});
return result;
}
exports.mapSymmetricDifference = mapSymmetricDifference;
//# sourceMappingURL=map-symmetric-difference.js.map