//#region src/Array/replaceOr.d.ts /** * # replaceOr * * ```ts * function Array.replaceOr( * target: readonly T[], * value: NoInfer, * replacement: NoInfer, * or: U, * ): readonly T[] | U * ``` * * Replaces the first occurrence of `value` in `target` with `replacement`. If `value` is not found, returns `or`. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.replaceOr([1, 2, 3, 2], 2, 9, []); // [1, 9, 3, 2] * Array.replaceOr([1, 2, 3], 4, 9, []); // [] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe([1, 2, 3, 2], Array.replaceOr(2, 9, [])); // [1, 9, 3, 2] * pipe([1, 2, 3], Array.replaceOr(4, 9, [])); // [] * ``` * */ declare const replaceOr: { (value: NoInfer, replacement: NoInfer, or: U): (target: T[]) => T[] | U; (value: NoInfer, replacement: NoInfer, or: U): (target: readonly T[]) => readonly T[] | U; (target: T[], value: NoInfer, replacement: NoInfer, or: U): T[] | U; (target: readonly T[], value: NoInfer, replacement: NoInfer, or: U): readonly T[] | U; }; //#endregion export { replaceOr };