extend.js icon indicating copy to clipboard operation
extend.js copied to clipboard

Return value of extend.myNamespace intentional?

Open jasonkarns opened this issue 12 years ago • 3 comments

Is there a use-case for returning the extend function itself from extend.myNamespace? Or was the return value chosen for lack of an alternative?

I ask, because of the use-case for returning the extended namespace instead:

window.myApp = extend.myNamespace({});

Perhaps a new method is in order?

window.myApp = extend.createNamespace();

jasonkarns avatar Jun 26 '13 14:06 jasonkarns

I didn't give a second thought to the return value of myNamespace since it's really just adds an extend method and (I believe?) throws things into a noConflict mode.

I'm not sure if the semantic difference of the above createNamespace is really worth it, but I don't think there's any harm in returning the extended object, that's for sure.

searls avatar Jun 29 '13 22:06 searls

  • [x] return the namespace, not the #extend method itself
  • [x] create the namespace if given undefined
  • [x] update the shared examples to test the extender. (shared examples are defined before the result is set by beforeEach)

jasonkarns avatar Jun 30 '13 03:06 jasonkarns

Finally figured out a way to get the shared examples to test an extender that wasn't set until the spec runs by using the Spec object. This is ready for review, finally.

jasonkarns avatar Sep 13 '13 02:09 jasonkarns