DieselDepot-APP/node_modules/es-toolkit/dist/fp/array/union.mjs
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

25 lines
758 B
JavaScript

import { union as union$1 } from "../../array/union.mjs";
//#region src/fp/array/union.ts
/**
* Creates a function that returns unique values from the piped array and secondArray.
*
* Values keep their first occurrence order, matching the main {@link union} behavior.
* Use the returned function with {@link pipe}.
*
* @template T - The type of elements in the arrays.
* @param secondArray - Values to include after the piped array.
* @returns A function that maps a readonly array to its union with secondArray.
*
* @example
* import { pipe, union } from 'es-toolkit/fp';
*
* pipe([1, 2], union([2, 3]));
* // => [1, 2, 3]
*/
function union(secondArray) {
return function(array) {
return union$1(array, secondArray);
};
}
//#endregion
export { union };