@sourcevault/lazybindall

0.0.5 • Public • Published

Build Status

Install Using Any ..

- npm install lazybindall

- npm install @sourcevault/lazybindall

Type Signature

lazybindall  :: ( ob , methds ) -> obmethds
  • ob <Object> - Methods in methds get bound to Ob.

  • methds <Object> - Object with props that are methods that we want to lock to ob

  • obmethds <Object> is an object whose props are defined be methds and have there context locked to ob.

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.

License

  • Code released under MIT Licence, see LICENSE for details.

  • Documentation released using CC-BY-4.0 see LICENSE for details.

Package Sidebar

Install

npm i @sourcevault/lazybindall

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

5.15 kB

Total Files

5

Last publish

Collaborators

  • sourcevault