@sourcevault/lazybindall
v0.0.5
Published
like bindall but lazy ¯\_(ツ)_/¯
Downloads
2
Maintainers
Readme
Install Using Any ..
- npm install lazybindall
- npm install @sourcevault/lazybindall
Type Signature
lazybindall :: ( ob , methds ) -> obmethds
ob <Object>
- Methods inmethds
get bound toOb
.methds <Object>
- Object with props that are methods that we want to lock toob
obmethds <Object>
is an object whose props are defined bemethds
and 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.1
release with a single exported function.