hunterloftis/awaiting

feature request: auto curry

Closed this issue ยท 5 comments

For some methods (e.g. callback) auto-currying feels like a nice extension to the existing behaviour.

e.g. const readFile = a.callback(fs.readFile)

I'm happy to work on a PR if the idea gets a ๐Ÿ‘

i thought to suggest to add "promisify" method that is actually what is curried callback method but no need

in anyway, dont see need for currying

I initially planned to implement a.promisified but I ended up using a.callback() all the time (vs const fooAsync = a.promisified(foo); await fooAsync(). @tunnckoCore it sounds like you came to the same conclusions I did.

That said, I would merge a PR with passing tests and a very simple promisified function. (I'd implement something new vs overloading callback), something like:

const readFile = a.promisified(fs.readFile)

Or actually better (since I really want to focus on async/await usage):

const readFile = a.async(fs.readFile)

What do you think @wheresrhys?

"promisified" isnt aounds like a correct and good name. promisify make a much more sense, it is well known.
i seen tha pr but will not comment there cuz im on phone so im lazy

Thinking a.async.

implemented by #9