/**
 * @since Last modified: 2024-01-24 09:15:39
 * @function pipe
 * @description Flat the nested function.Run function from left to right.
 * @param {array} args - The array of functions.
 * @returns  {function} - The flat function(the last function).
 * @see {@link https://codepen.io/axui/pen/vYbMgOb|demo @ codepen}
 * @example
 * ax.pipe(fn1,fn2,fn3)(val);
 * <!--The same as : fn3(fn2(fn1(val)))-->
 * <!--ax.pipe(fn1,fn2,fn3) will return the fn3-->
 */
'use strict';
import { T_fn } from "../../../types/ax";
const pipe = (...args: T_fn[]) => {
    args = args.filter(Boolean);
    return (initial: any) => args.reduce((prev, cur) => cur(prev), initial);
}
export default pipe;
