Using RequireJS exports with CoffeeScript

If you are using the “exports” object in your RequireJS module definition and happen to also be using CoffeeScript then be careful to either return the exports object at the end of the function or explicitly return nothing from the function by typing “return” on the last line. Like so:

define((require, exports, module) ->
    exports.foo = 'bar'
    return
)

If you don’t return nothing or the exports object CoffeeScript will compile this:

define((require, exports, module) ->
    exports.foo = 'bar'
)

…to the following javascript:

define(function(require, exports, module) {
    return exports.foo = 'bar';
});

Where the return value will be the string ‘bar’. This is no good because if you return a value from your module definition function, RequireJs uses it instead of the exports object. So when you come to require your module, you’ll be passed a String, rather than an object with a “foo” property as you’d expect.

18 thoughts on “Using RequireJS exports with CoffeeScript

  1. 2012; 53 659 63 cialis online no prescription It is just that this man in black exudes an extremely terrifying aura

  2. His father steps into the shower turning on the water. As he soaks and lathers himself up under the lukewarm stream of water he fondles his cock and balls. His cock soon mimics that of his son. gay sex porn Garrett can see what his father is doing unconsciously his hands moves to his cock. He strokes the length of his tool with his left hand while he teases the blistering red crown with the fingertips of his right hand. The lightning of his cool fingertips sends sparks through every nerve in his body.

  3. The helmet of the man’s cock weaves a picture of no recognition as the father’s cum streaks itself through the watery haze. “That you are son. You are busting at the seams with your youth and muscles. Rippled from those vigorous physical workouts and stroking sessions. I bet.” His dad says. “You are gonna hafta to take care of that or you are gonna be miserable. You know that son doncha. You know I am right.”

  4. “And you did it with that. Your boner?” His dad asks. “I guess.” “You are grown. Yes. Physically. Yes my son. But a full man. No No” His father says sharply. “You have much more to grow to mature before you are a man before you can call yourself. A man.”

  5. “What did Coach have to say when he saw all those hard-young cocks in the locker room?” His dad asks. He lifts his head from its bowed stance and looks into the eyes of his father wanting some acknowledgement.

  6. “You lettin’ the beard grow on your face I see son?” His father asks him as his head bumps up under the chin of his towering son.

  7. Hello my loved one I wish to say that this post is amazing great written and come with almost all significant infos. I’d like to see extra posts like this. aotasset.airportthai.co.th

  8. pastillas priligy en mexico Treatment with the combination of tamoxifen plus metformin or ATO leads to increases in glucose uptake in MCF7 cells reflecting metabolic uncoupling between epithelial cancer cells and fibroblasts

  9. progressive edemawhich might be related 10proteinuriaandnephrotic syndrome priligy india

  10. Vibrox indications priligy 30mg tablets After six years of trying we finally conceived with the help of gonadotropins and 36 weeks and six days later I gave birth to beautiful twins

  11. The nuclear cytoplasmic shuttling of proteins has direct implications for dynamic changes in the role of the translocated protein what is priligy tablets

  12. Talk to your provider about the best way to feed your baby while taking fluoxetine can i buy priligy in usa The possible mechanism linking the observed defects in the MET current and the reduced expression of I K n is less clear

  13. buy priligy australia Dental anomalies have also been reported including delayed loss of primary or baby teeth persistent primary dentition multiple missing teeth oligodontia and teeth that are abnormally crowded together

  14. buy priligy pills Although it s cool in Februrary I m constantly having to wear light clothing

  15. Edema and circulatory congestion are usually not sufficiently marked to produce more than minimal discomfort dapoxetina generico

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>