👁 查看:index.js
路径:/home/boguraj1/public_html/jobsite/node_modules/p-pipe/index.js
大小:343 B · 修改:2022-11-21 20:10:54 · 权限:0644 · 可写
'use strict';

module.exports = (...functions) => {
	if (functions.length === 0) {
		throw new Error('Expected at least one argument');
	}

	return async input => {
		let currentValue = input;

		for (const fn of functions) {
			currentValue = await fn(currentValue); // eslint-disable-line no-await-in-loop
		}

		return currentValue;
	};
};