Created
June 17, 2013 19:03
-
-
Save mvasilkov/5799383 to your computer and use it in GitHub Desktop.
Sample code for Kiril Vatev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lib = function() { | |
/* lib() is the same as lib.a() */ | |
return lib.a.apply(lib, arguments) | |
} | |
lib.a = function() { | |
/* do somethig, e.g. */ | |
console.log('lib.a() called with', arguments) | |
/* allow chaining */ | |
return lib | |
} | |
lib.b = function() { | |
/* do somethig, e.g. */ | |
console.log('lib.b() called with', arguments) | |
/* allow chaining */ | |
return lib | |
} | |
/* usage: */ | |
lib(0).a(1).b(2) | |
/* this outputs: */ | |
// lib.a() called with [0] | |
// lib.a() called with [1] | |
// lib.b() called with [2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment