mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-19 18:25:51 +10:00
11 lines
291 B
JavaScript
11 lines
291 B
JavaScript
/**
|
|
* Build functional pipeline.
|
|
*/
|
|
module.exports = function compose (...processors) {
|
|
if (processors.length === 0) return input => input
|
|
if (processors.length === 1) return processors[0]
|
|
return processors.reduce((prev, next) => {
|
|
return (...args) => next(prev(...args))
|
|
})
|
|
}
|