/**
 *
 * @param {...function} processes
 * @returns {function(*): *}
 */
export function chain(...processes) {
    const numProcesses = processes.length;

    return function chain(v) {
        let result = v;

        for (let i = 0; i < numProcesses; i++) {
            const process = processes[i];
            result = process(result);
        }

        return result;
    }
}