0.0.5 • Published 8 years ago
@sourcevault/lazybindall v0.0.5
Install Using Any ..
- npm install lazybindall
- npm install @sourcevault/lazybindallType Signature
lazybindall :: ( ob , methds ) -> obmethdsob <Object>- Methods inmethdsget bound toOb.methds <Object>- Object with props that are methods that we want to lock toobobmethds <Object>is an object whose props are defined bemethdsand have there context locked toob.
Simple Example
var foo = {name:"sourcevault"}
var methds =
{
show:function()
{
console.log (this)
}
}
// ----------------------------------------------
var lazybindall = require ("@sourcevault/lazybindall")
var bound = lazybindall ( foo , methds )
bound.show() // {name:"sourcevault"}Benchmark
...for 10,000 object with 9 methods
| Method | Total Memory (MB) | Time (millisecond) |
|---|---|---|
.prototype | 6 | 31 |
| lazy closure | 9 | 54 |
| eagar closure | 49 | 6,172 |
|.. view detailed documentation .. | --- |
Updates and API change
- Initial
0.0.1release with a single exported function.