UNPKG

rambda

Version:

Lightweight and faster alternative to Ramda with included TS definitions

12 lines (10 loc) 302 B
import { type } from './type.js' export async function pipeAsync(input, ...fnList) { let willReturn = input for (const fn of fnList) { const initialResult = fn(willReturn) willReturn = type(initialResult) === 'Promise' ? await initialResult : initialResult } return willReturn }