UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

235 lines 12.8 kB
//#region src/fp/pipe.d.ts /** * Returns `value` unchanged — the identity case of {@link pipe} with no functions. * * @param value - The initial value fed into the pipe. * @returns `value`, unchanged. */ declare function pipe<A>(value: A): A; /** * Pipes `value` through `fn1`, returning its result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @returns The result of `fn1`. */ declare function pipe<A, B>(value: A, fn1: (input: A) => B): B; /** * Pipes `value` left-to-right through `fn1` to `fn2`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @returns The result of `fn2` — the value returned by the last function. */ declare function pipe<A, B, C>(value: A, fn1: (input: A) => B, fn2: (input: B) => C): C; /** * Pipes `value` left-to-right through `fn1` to `fn3`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @returns The result of `fn3` — the value returned by the last function. */ declare function pipe<A, B, C, D>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D): D; /** * Pipes `value` left-to-right through `fn1` to `fn4`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @returns The result of `fn4` — the value returned by the last function. */ declare function pipe<A, B, C, D, E>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E): E; /** * Pipes `value` left-to-right through `fn1` to `fn5`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @returns The result of `fn5` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F): F; /** * Pipes `value` left-to-right through `fn1` to `fn6`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @returns The result of `fn6` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G): G; /** * Pipes `value` left-to-right through `fn1` to `fn7`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @returns The result of `fn7` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H): H; /** * Pipes `value` left-to-right through `fn1` to `fn8`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @returns The result of `fn8` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I): I; /** * Pipes `value` left-to-right through `fn1` to `fn9`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @returns The result of `fn9` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J): J; /** * Pipes `value` left-to-right through `fn1` to `fn10`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @returns The result of `fn10` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K): K; /** * Pipes `value` left-to-right through `fn1` to `fn11`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @param fn11 - Applied to the result of `fn10`. * @returns The result of `fn11` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K, fn11: (input: K) => L): L; /** * Pipes `value` left-to-right through `fn1` to `fn12`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @param fn11 - Applied to the result of `fn10`. * @param fn12 - Applied to the result of `fn11`. * @returns The result of `fn12` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K, fn11: (input: K) => L, fn12: (input: L) => M): M; /** * Pipes `value` left-to-right through `fn1` to `fn13`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @param fn11 - Applied to the result of `fn10`. * @param fn12 - Applied to the result of `fn11`. * @param fn13 - Applied to the result of `fn12`. * @returns The result of `fn13` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K, fn11: (input: K) => L, fn12: (input: L) => M, fn13: (input: M) => N): N; /** * Pipes `value` left-to-right through `fn1` to `fn14`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @param fn11 - Applied to the result of `fn10`. * @param fn12 - Applied to the result of `fn11`. * @param fn13 - Applied to the result of `fn12`. * @param fn14 - Applied to the result of `fn13`. * @returns The result of `fn14` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K, fn11: (input: K) => L, fn12: (input: L) => M, fn13: (input: M) => N, fn14: (input: N) => O): O; /** * Pipes `value` left-to-right through `fn1` to `fn15`, returning the final result. * * @param value - The initial value fed into the pipe. * @param fn1 - Applied to `value`. * @param fn2 - Applied to the result of `fn1`. * @param fn3 - Applied to the result of `fn2`. * @param fn4 - Applied to the result of `fn3`. * @param fn5 - Applied to the result of `fn4`. * @param fn6 - Applied to the result of `fn5`. * @param fn7 - Applied to the result of `fn6`. * @param fn8 - Applied to the result of `fn7`. * @param fn9 - Applied to the result of `fn8`. * @param fn10 - Applied to the result of `fn9`. * @param fn11 - Applied to the result of `fn10`. * @param fn12 - Applied to the result of `fn11`. * @param fn13 - Applied to the result of `fn12`. * @param fn14 - Applied to the result of `fn13`. * @param fn15 - Applied to the result of `fn14`. * @returns The result of `fn15` — the value returned by the last function. */ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(value: A, fn1: (input: A) => B, fn2: (input: B) => C, fn3: (input: C) => D, fn4: (input: D) => E, fn5: (input: E) => F, fn6: (input: F) => G, fn7: (input: G) => H, fn8: (input: H) => I, fn9: (input: I) => J, fn10: (input: J) => K, fn11: (input: K) => L, fn12: (input: L) => M, fn13: (input: M) => N, fn14: (input: N) => O, fn15: (input: O) => P): P; //#endregion export { pipe };