geilt

Underscore

Jul 1st, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. File 1:
  2. _ = require('underscore')._;
  3.  
  4. Controller.prototype.loadInit = function( controller ){
  5. if(controller[1] in this.models){
  6. this.model = this.models[controller[1]];
  7. }
  8. var req = {
  9. sockets: this.sockets,
  10. controller: controller[1],
  11. utils: this.utils,
  12. library: this.library,
  13. app: this.app,
  14. config: this.config,
  15. db: this.db,
  16. models: this.models,
  17. model: this.model,
  18. _: _
  19. };
  20.  
  21. controller[0].init(req);
  22. };
  23.  
  24. File 2:
  25. module.exports = {
  26. init: function(req){
  27. console.log(_);
  28. }
  29. }
  30. //I want to use _ inside the init function without having to redefine underscore in file 2
Advertisement
Add Comment
Please, Sign In to add comment