Name: decorate
Owner: npm
Description: decorate a function transparently
Created: 2017-05-06 01:02:29.0
Updated: 2018-04-06 03:35:44.0
Pushed: 2017-05-24 05:40:20.0
Homepage: null
Size: 5
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Decorate a function, forwarding properties.
t decorate = require('@npm/decorate')
tion myFunction () {
turn 1
nction.bloo = 3
t decorated = decorate(myFunction, (...args) => {
turn myFunction(...args) + 1
ole.log(decorated.name) // myFunction
ole.log(decorated.bloo) // 3
ole.log(decorated()) // 2
decorate(inner, wrapper) -> Function
Forward all properties from inner to a merged function that calls wrapper.
decorate.undecorate(Function) -> Function | Null
Return the inner function of a decorated function. or null.
decorate.decorations(Function) -> Iterator<Function>
Return an iterator that yields all decoration wrappers of a given function in order.
ISC