1.2.3 • Published 6 years ago

adhere v1.2.3

Weekly downloads
95
License
MIT
Repository
github
Last release
6 years ago

Wrap methods preserving arity.

Synopsis

The adhere method allows you to define a function factory that wraps a user function, but preserving the airty of the wrapped function.

var switcharoo = function (method) {
    return adhere(method, function (object, vargs) {
        vargs.reverse()
        method.apply(object, vargs)
    })
}

var reversed = switcharoo(function (a, b) { return [ a, b ] })

assert.deepEqual(reversed(1, 2), [ 2, 1 ], 'reversed')

This airty preservation has been extracted from Cadence. This function builder is used to preserve airty in Pointcut.

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago