UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

16 lines (15 loc) 528 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.arraySymmetricDifference = void 0; /** * Returns elements present in exactly one of two arrays. * @author @dailker * @template T * @param {T[]} a - First array. * @param {T[]} b - Second array. * @returns {T[]} Symmetric difference. */ function arraySymmetricDifference(a, b) { return a.filter(x => !b.includes(x)).concat(b.filter(x => !a.includes(x))); } exports.arraySymmetricDifference = arraySymmetricDifference;