douglascrockford / parseq

Better living thru immediacy!
214 stars 28 forks source link

Non-binary callbacks #14

Closed jamesdiacono closed 1 year ago

jamesdiacono commented 1 year ago

During development, I often want to pass console.log as the callback function to a requestor. However, parseq requires that the callback.length property is exactly 2, so it rejects console.log because console.log.length is 0.

I also feel it would make sense for parseq to accept unary functions as callbacks. Since the success or failure of a requestor is encoded in the value, the reason can safely be ignored without changing the behaviour of the program.

Would you please consider removing the arity check for callbacks?

douglascrockford commented 1 year ago

You can easily wrap console.log in an appropriate function.