Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SOME REUSABLE MODULE. */
- class MyLib {
- constructor( apiKey = process.env.MY_LIB_API_KEY ) {
- this.apiKey = apiKey;
- }
- inspect() {
- return( `API KEY: ${ this.apiKey }` );
- }
- }
- // ----------------------------------------------------------------------------------- //
- // ----------------------------------------------------------------------------------- //
- /* THE APPLICATION BOOTSTRAPPING PROCESS. */
- // Notice that when the application instantiates the MyLib() class, it doesn't provide
- // an explicit constructor argument. Instead, it allows the target module to fall-back
- // to the GLOBAL STATE represented in the "process.env" object.
- var myLib = new MyLib();
- console.log( myLib.inspect() );
Add Comment
Please, Sign In to add comment