Skip to content

Instantly share code, notes, and snippets.

Gheorghe GheorgheP

Block or report user

Report or block GheorgheP

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View composeAsync.js
const composeAsync = (...fs) => {
if (fs.length === 0) {
throw new Error('compose requires at least one argument')
}
return async (...as) => {
const call = async fs => {
const f = fs[0]
const tail = fs.slice(1, Infinity)
return await tail.length === 0 ? f(...as) : f(await call(tail))
@GheorgheP
GheorgheP / gist:f593e5579ca945687b2005d460c9ec77
Created Apr 23, 2017
ES6 curry, with normal function behavior
View gist:f593e5579ca945687b2005d460c9ec77
const curry = f => {
const _curry = (args = []) => args.length < f.length ? (...a) => _curry([...args, ...a]) : f(...args)
return _curry()
}
You can’t perform that action at this time.