i got two javascript objects api
and myApi
:
var api = {};
api.foo = function(){ ... };
api.foo2 = function(){ ... };
var myApi = {};
myApi.foo = function(){ ...};
myApi.myFoo = function(){ ...};
myApi.myFoo2 = function(){ ...};
i want to add all myApi.*
functions to api
object without overriding api.foo
.
Indeed, i want learn how to extend APIs to each other and developing plugins with javascript.
What are the best practices in this subject?