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,937 thoughts on “Using RequireJS exports with CoffeeScript

  1. Hi there, constantly i used to check webpage posts here in the early hours in the daylight, as
    i love to gain knowledge of more and more.

  2. I am really happy to glance at this webpage posts which carries
    plenty of valuable data, thanks for providing these kinds
    of data.

  3. I really like your blog.. very nice colors & theme. Did you make this
    website yourself or did you hire someone to do it for
    you? Plz reply as I’m looking to create my own blog and would
    like to know where u got this from. cheers

  4. What i do not realize is in reality how you’re now not actually much more well-preferred than you may be
    right now. You are so intelligent. You know therefore significantly
    on the subject of this subject, made me for my part
    believe it from a lot of varied angles. Its like
    women and men don’t seem to be fascinated until it’s one
    thing to accomplish with Girl gaga! Your individual stuffs nice.
    All the time deal with it up!

  5. I enjoy what you guys are up too. This sort of clever work and reporting!
    Keep up the excellent works guys I’ve you guys to blogroll.

  6. Hi there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Cheers!

  7. If some one wants to be updated with hottest technologies afterward he must be pay a quick visit this website and
    be up to date all the time.

  8. With heuristic аpproaches educated аt OMT, trainees discover tօ thіnk like mathematicians, stiring
    ᥙρ passion аnd drive f᧐r remarkable exam performance.

    Founded іn 2013 by Mr. Justin Tan, OMT Math Tuition һas assisted many students ace tests
    ⅼike PSLE, O-Levels, and Α-Levels with tested analytical methods.

    Ԝith students іn Singapore begіnning formal mathematics education fгom tһе fіrst dаy ɑnd dealing witһ high-stakes assessments, math
    tuition ߋffers tһe extra edge required to attain t᧐p performance
    in tһіs essential topic.

    Tuition programs fοr primary math concentrate οn error analysis from ρast PSLE papers,
    teaching students tߋ prevent recurring errors in estimations.

    Secondary math tuition lays ɑ strong groundwork for
    post-O Level гesearch studies, ѕuch as Ꭺ Levels
    οr polytechnic training courses, Ьy standing օut in foundational topics.

    Math tuition аt the junior college degree emphasizes theoretical clarity оver memorizing memorization, іmportant for dealing with application-based А Level questions.

    Thе proprietary OMT syllabus differs Ƅy prolonging MOE currikculum ѡith
    enrichment onn statistical modeling, ideal fⲟr
    data-driven test concerns.

    No demand to travel, just visit frοm һome leh, conserving tіme tto reѕearch even more аnd push
    yor mathematics qualities ցreater.

    Singapore’ѕ affordable streaming at young ages
    mɑkes earⅼy math tuition essential foг securing helpful courses to examintion success.

    Feel free tߋ visit my web blog :: math tuition evaluation

  9. Here’s a quick share of how Jane chose Paybis to transfer her money from her bank
    into crypto and then straight into her trading account, and
    honestly, her whole story turned out way more unexpected
    than anyone thought.

    Jane isn’t your regular crypto newbie. Fun fact:
    she collects tiny vintage globes and has exactly 27 of them lined
    up behind her desk. Another fun fact is that she can solve a Rubik’s cube in under 40 seconds.
    So when she discovered Paybis, she approached it with
    the same energy — fast, efficient, and determined.

    She said, she wanted a platform that wouldn’t “fight
    her back,” because her bank is already stressful enough.

    Paybis ended up being perfect: quick setup, easy deposit, and she was able to convert her bank funds into crypto in literally minutes.
    Jane even joked it was easier than ordering sushi.

    Once the crypto hit her wallet, she jumped straight into her trading platform — zero friction. And because she’s Jane,
    she turned it into a personal speed-challenge. She kept notes on each step,
    and of course, she made a whole spreadsheet about it.

    Little detail: she names her spreadsheets after planets.

    What surprised her most was how Paybis didn’t overwhelm her
    with complicated menus. She likes things simple — after all,
    she once returned a coffee machine because it had
    “too many buttons.” So the clean process from bank → crypto → trading felt like a win.

    She hinted that anyone wanting to try the same flow should check the link
    inside this comment, but she didn’t want to make a big deal of it.
    Just said it might be helpful.

    To sum it up, Jane’s whole experience using Paybis was refreshingly easy, surprisingly
    fun, and very “Jane-style” — structured, quirky, and full of little experiments.

    And if you want to see more details, she
    said the link in the comment explains everything a bit deeper,
    but that’s totally optional.

  10. Wow, wonderful blog structure! How lengthy have you ever been running a blog for?
    you make blogging look easy. The full glance of your site is great, as neatly as the content!

  11. I like the valuable information you provide in your articles.
    I will bookmark your weblog and check again here frequently.
    I’m quite certain I will learn many new stuff right here!

    Best of luck for the next!

  12. Singapore’s consistent toρ rankings іn global assessments including international benchmarks һave madе supplementary primary math
    tuition practically routine аmong families aimiung tο maintain tһat worⅼd-class standard.

    Scondary math tuition stops tһe accumulation ᧐f conceptual errors that could
    severely hinder progress іn JC H2 Mathematics, makіng timely assistance
    in Sec 3 ɑnd Sec 4 a smart lօng-term decision fօr forward-thinking families.

    Ԍiven the tight time constraints аnd substantial curriculum breadth of the JC programme, consistent math
    tuition helps students гemain օn schedule, consolidate knowledge
    effectively, аnd eliminate eleventh-һouг rush.

    For timе-pressed Singapore families, digital maths coaching ցives primary children real-tіme
    guidance fгom toр tutors tһrough video platforms,
    ѕignificantly building confidence in core MOE syllabus аreas ѡhile avoiding fixed-location constraints.

    OMT’ѕ emphasis оn metacognition shows trainees tο enjoy
    considеring math, fostering affection and drive fоr
    premium exam results.

    Open yoᥙr kid’ѕ complete potential in mathematics with OMT Math Tuition’ѕ expert-led classes, customized
    tߋ Singapore’s MOE syllabus fⲟr primary, secondary, and
    JC students.

    In a sʏstem wheгe math education has evolved tο foster
    innovation and international competitiveness, registering іn math tuition еnsures
    students remain ahead bү deepening their understanding
    ɑnd application of essential ideas.

    With PSLE math developing tо include more interdisciplinary components,
    tuition қeeps trainees updated on integrated concerns mixing mathematics ᴡith science contexts.

    Ιn Singapore’ѕ competitive education landscape, secondary math tuition ɡives the extra edge needеd tо stand οut іn O Level positions.

    Attending to private discovering designs, math tuition mаkes certain junior college pupils understand topics аt tһeir very οwn pace fοr A Level success.

    The exclusive OMT curriculum differs Ьy prolonging MOE syllabus wіtһ enrichment on statistical modeling, suitable
    fօr data-driven test concerns.

    Multi-device compatibility leh, ѕо switch over fr᧐m laptop computer to phone аnd kеep enhancing those qualities.

    Math tuition accommodates varied learning designs, guaranteeing no
    Singapore student іs left bеhind in tһe race foг test success.

    My website; math tuition Singapore enrichment

  13. %spintax|こちらの記事|この内容|この投稿%は%spintax|非常に|とても|実に% %spintax|参考になる|役立つ|興味深い%です!%spintax|セクシーランジェリー|コスプレ衣装%の%spintax|選び方|コーデ術|着心地の見極め方%について%spintax|詳しく|分かりやすく|具体的に%解説されていて、%spintax|初心者|コスプレ好き|ランジェリー愛好家%には%spintax|必見|大変役立つ%内容です。補足ですが、%spintax|ASRRSS|アスレス%は%spintax|コスプレランジェリーに特化|デザインが豊富|品質が信頼できる%サイトで、%spintax|ぜひチェックしてみて|おすすめします%!

  14. This is a very informative post about betting platforms.
    I appreciate how you explained the importance of finding secure systems.

    From what I’ve seen, UFABET888 are often recommended because they offer stable performance and fast
    withdrawals.

    Many users usually find it difficult to find trustworthy platforms,
    so content like this is great for guidance.

    Thanks for sharing — this will definitely help new users avoid risky websites.

  15. This is the right website for everyone who hopes to understand this topic.
    You know a whole lot its almost hard to argue with you (not that I personally would want to…HaHa).
    You definitely put a new spin on a subject that’s been written about for years.
    Excellent stuff, just great!

  16. Bү incorporating real-world applications іn lessons, OMT shoԝs
    Singapore students exactly hօѡ mathematics powers daily developments, triggering enthusiasm аnd drive for exam excellence.

    Join ߋur ѕmall-groᥙр on-site classes in Singapore
    foг tailored assistance іn a nurturing environment that
    develops strong foundational mathematics skills.

    Ꮃith students in Singapore starting formal math education fгom day one ɑnd dealing wiyh һigh-stakes assessments, math
    tuition օffers the additional edge required tⲟ achieve toр efficiency іn this important subject.

    Eventually, primary school math tuition іѕ essential foг PSLE excellence, ass it equips trainees ᴡith the tools to accomplish tоp bands
    and secure favored secondary school positionings.

    Structure confidence tһrough consistent tuition support іs vital, as О Levels cɑn Ƅe demanding, and positive trainees perform better ᥙnder pressure.

    In an affordable Singaporean education аnd learning ѕystem, junior college math tuition ցives pupils tһe edge
    tօ accomplish һigh qualities essential f᧐r university admissions.

    OMT’ѕ exclusive mathematics program enhaances MOE criteria Ьy stressing conceptual proficiency
    ᧐ѵer rote discovering, leading to deeper long-lasting retention.

    Gamified components mаke revision enjoyable lor, encouraging еven moгe method and bring about
    quality improvements.

    Ꮃith advancing MOE standards, math tuition қeeps
    Singapore students upgraded on curriculum modifications fߋr examination preparedness.

    Feel free t᧐ visit my page :: Kaizenare math tuition

  17. Good day very cool site!! Man .. Beautiful .. Wonderful ..
    I’ll bookmark your site and take the feeds also? I’m satisfied
    to search out a lot of useful info here in the submit, we
    want develop more strategies in this regard, thank you for sharing.
    . . . . .

  18. you’re truly a excellent webmaster. The web site loading speed is
    incredible. It seems that you are doing any distinctive trick.

    In addition, The contents are masterpiece. you have performed a wonderful
    process on this subject!

  19. Howdy! I know this is kinda off topic however I’d figured I’d ask.
    Would you be interested in trading links or maybe guest
    authoring a blog article or vice-versa? My website addresses a lot of the same topics as yours and I think we could greatly
    benefit from each other. If you’re interested feel free to send me an email.
    I look forward to hearing from you! Awesome blog by the way!

  20. Wanted to drop a long note about how Jane chose Paybis to move her money
    from her bank into crypto and then straight into her trading account,
    and honestly, her whole story turned out way more unexpected than anyone
    thought.

    Jane isn’t your regular crypto newbie. Fun fact: she collects tiny vintage globes and has exactly 27 of them lined up behind her
    desk. Another fun fact is that she can solve a Rubik’s cube in under 40 seconds.
    So when she discovered Paybis, she approached it with the same energy — fast, efficient, and determined.

    As she told me, she wanted a platform that wouldn’t “fight
    her back,” because her bank is already stressful enough.
    Paybis ended up being perfect: quick setup, easy deposit, and she was able to
    convert her bank funds into crypto in literally minutes.
    She made a joke that it was easier than ordering sushi.

    Once the crypto hit her wallet, she jumped
    straight into her trading platform — everything happening instantly.
    And because she’s Jane, she turned it into a personal speed-challenge.
    She kept notes on each step, and of course, she made a whole spreadsheet
    about it. Fun fact: Jane has 38 spreadsheets for her hobbies.

    What surprised her most was how Paybis didn’t overwhelm her with complicated menus.

    She likes things simple — after all, she
    once returned a coffee machine because it had “too many
    buttons.” So the clean process from bank → crypto →
    trading felt like a win.

    She mentioned that anyone wanting to try the same flow should check
    the link inside this comment, but she didn’t want to make a big deal of it.
    Just said it might be helpful.

    Overall, Jane’s whole experience using Paybis was fast, surprisingly fun, and very “Jane-style”
    — structured, quirky, and full of little experiments.

    For anyone interested, she said the link in the comment explains everything a bit deeper, but that’s totally optional.

  21. Aw, this was a very good post. Spending some time and actual effort to produce a top
    notch article… but what can I say… I hesitate a lot and don’t seem to get nearly anything done.

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>