Guest User

Untitled

a guest
May 26th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /* SOME REUSABLE MODULE. */
  2.  
  3. class MyLib {
  4.  
  5. constructor( apiKey = process.env.MY_LIB_API_KEY ) {
  6.  
  7. this.apiKey = apiKey;
  8.  
  9. }
  10.  
  11. inspect() {
  12.  
  13. return( `API KEY: ${ this.apiKey }` );
  14.  
  15. }
  16.  
  17. }
  18.  
  19. // ----------------------------------------------------------------------------------- //
  20. // ----------------------------------------------------------------------------------- //
  21.  
  22. /* THE APPLICATION BOOTSTRAPPING PROCESS. */
  23.  
  24. // Notice that when the application instantiates the MyLib() class, it doesn't provide
  25. // an explicit constructor argument. Instead, it allows the target module to fall-back
  26. // to the GLOBAL STATE represented in the "process.env" object.
  27. var myLib = new MyLib();
  28.  
  29. console.log( myLib.inspect() );
Add Comment
Please, Sign In to add comment