20 lines
655 B
TypeScript
20 lines
655 B
TypeScript
|
|
//#region src/fp/array/xor.d.ts
|
||
|
|
/**
|
||
|
|
* Creates a function that returns the symmetric difference with secondArray.
|
||
|
|
*
|
||
|
|
* The result contains values that appear in exactly one of the arrays, matching the main
|
||
|
|
* {@link xor} behavior.
|
||
|
|
*
|
||
|
|
* @template T - The type of elements in the arrays.
|
||
|
|
* @param secondArray - Values to compare with the piped array.
|
||
|
|
* @returns A function that maps a readonly array to its symmetric difference.
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* import { pipe, xor } from 'es-toolkit/fp';
|
||
|
|
*
|
||
|
|
* pipe([1, 2], xor([2, 3]));
|
||
|
|
* // => [1, 3]
|
||
|
|
*/
|
||
|
|
declare function xor<T>(secondArray: readonly T[]): (array: readonly T[]) => T[];
|
||
|
|
//#endregion
|
||
|
|
export { xor };
|