a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839
  1. module.exports = function loadLoader(loader, callback) {
  2. if(typeof System === "object" && typeof System.import === "function") {
  3. System.import(loader.path).catch(callback).then(function(module) {
  4. loader.normal = typeof module === "function" ? module : module.default;
  5. loader.pitch = module.pitch;
  6. loader.raw = module.raw;
  7. if(typeof loader.normal !== "function" && typeof loader.pitch !== "function")
  8. throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)");
  9. callback();
  10. });
  11. } else {
  12. try {
  13. var module = require(loader.path);
  14. } catch(e) {
  15. // it is possible for node to choke on a require if the FD descriptor
  16. // limit has been reached. give it a chance to recover.
  17. if(e instanceof Error && e.code === "EMFILE") {
  18. var retry = loadLoader.bind(null, loader, callback);
  19. if(typeof setImmediate === "function") {
  20. // node >= 0.9.0
  21. return setImmediate(retry);
  22. } else {
  23. // node < 0.9.0
  24. return process.nextTick(retry);
  25. }
  26. }
  27. return callback(e);
  28. }
  29. if(typeof loader !== "function" && typeof loader !== "object")
  30. throw new Error("Module '" + loader.path + "' is not a loader (export function or es6 module))");
  31. loader.normal = typeof module === "function" ? module : module.default;
  32. loader.pitch = module.pitch;
  33. loader.raw = module.raw;
  34. if(typeof loader.normal !== "function" && typeof loader.pitch !== "function")
  35. throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)");
  36. callback();
  37. }
  38. };