4 Node method and accessor delegation utilty.
9 $ npm install delegates
15 var delegate = require('delegates');
19 delegate(proto, 'request')
20 .method('acceptsLanguages')
21 .method('acceptsEncodings')
22 .method('acceptsCharsets')
25 .access('querystring')
49 ## Delegate(proto, prop)
51 Creates a delegator instance used to configure using the `prop` on the given
52 `proto` object. (which is usually a prototype)
54 ## Delegate#method(name)
56 Allows the given method `name` to be accessed on the host.
58 ## Delegate#getter(name)
60 Creates a "getter" for the property with the given `name` on the delegated
63 ## Delegate#setter(name)
65 Creates a "setter" for the property with the given `name` on the delegated
68 ## Delegate#access(name)
70 Creates an "accessor" (ie: both getter *and* setter) for the property with the
71 given `name` on the delegated object.
73 ## Delegate#fluent(name)
75 A unique type of "accessor" that works for a "fluent" API. When called as a
76 getter, the method returns the expected value. However, if the method is called
77 with a value, it will return itself so it can be chained. For example:
80 delegate(proto, 'request')
84 var q = request.query();