Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Note that <code>coffee-script</code> isn't a valid identifier, so your code isn't really importing it properly. You can use CoffeeScript's flexible object literals to handle this pretty nicely. I'd also use <code>?=</code> to avoid unnecessarily re-importing modules. Building off of <a href="https://stackoverflow.com/q/7263166">user211399's answer</a>:</p> <pre> global[id] ?= require name for id, name of { "connect", "express", "redis", "sys", coffee: "coffee-script", "fs" } <sup>[<a href="http://coffeescript.org/#try:global%5Bid%5D%20%3F%3D%20require%20name%20for%20id%2C%20name%20of%20%7B%0A%20%20%20%20%22connect%22%2C%20%22express%22%2C%20%22redis%22%2C%20%22sys%22%2C%20coffee%3A%20%22coffee-script%22%2C%20%22fs%22%20%7D" rel="nofollow noreferrer">Compile to JS</a>]</sup> </pre> <p>Since I'm allowing you to import with different identifiers in different modules, using the global namespace feels particularly unsafe. I'd import them locally instead, as shown below. Be aware that because this uses <code>eval</code> it might not fail gracefully if you specify an illegal identifier.</p> <pre> eval "#{id} = require(#{JSON.stringify name})" name for id, name of { "connect", "express", "redis", "sys", coffee: "coffee-script", "fs" } <sup>[<a href="http://coffeescript.org/#try:eval%20%22%23%7Bid%7D%20%3D%20require(%23%7BJSON.stringify%20name%7D)%22%20name%20for%20id%2C%20name%20of%20%7B%0A%20%20%20%20%22connect%22%2C%20%22express%22%2C%20%22redis%22%2C%20%22sys%22%2C%20coffee%3A%20%22coffee-script%22%2C%20%22fs%22%20%7D" rel="nofollow noreferrer">Compile to JS</a>]</sup> </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload