method-combinators icon indicating copy to clipboard operation
method-combinators copied to clipboard

Arguments for "after"

Open jeron-diovis opened this issue 11 years ago • 0 comments

It is not enough to pass to after decorator only value, returned by decorated function. There can bee some logic, based on arguments of decorated function.

Of course, around can be used for this, but why should we care about manually calling origin fn?

Should be something like this:

this.after =
  (decoration) ->
    (base) ->
      (argv...) ->
        decoration.apply(this, [__value__ = base.apply(this, arguments)].concat(argv))
        __value__

jeron-diovis avatar May 22 '14 09:05 jeron-diovis