Skip to content

Instantly share code, notes, and snippets.

@cerebrl
Last active August 26, 2015 04:56
Show Gist options
  • Select an option

  • Save cerebrl/0e50e0f36ccce063790a to your computer and use it in GitHub Desktop.

Select an option

Save cerebrl/0e50e0f36ccce063790a to your computer and use it in GitHub Desktop.

Revisions

  1. cerebrl revised this gist Aug 26, 2015. No changes.
  2. cerebrl revised this gist Aug 26, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion module-api.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    /** ****************************************
    * App level module for say hi
    * Module for say hi feature
    * @module sayHiFactory
    * @returns {object}
    */
  3. cerebrl revised this gist Aug 26, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion module-api.js
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,6 @@ function sayHiFactory() {
    sayHi: pblcSayHi
    };
    }

    // module.exports = sayHiFactory();

    /**
  4. cerebrl revised this gist Aug 26, 2015. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion module-api.js
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,12 @@ function sayHiFactory() {
    };
    }

    // module.exports = sayHiFactory();
    // module.exports = sayHiFactory();

    /**
    * Pros: no implicit environment, easier mental model, more flexibility left to implementation, no `new` needed
    * Cons: it's different? It's not what everyone else does?
    *
    * Is it programming to an interface? Yup!
    * Is it composable? Yup!
    */
  5. cerebrl revised this gist Aug 26, 2015. No changes.
  6. cerebrl renamed this gist Aug 26, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. cerebrl revised this gist Aug 26, 2015. No changes.
  8. cerebrl renamed this gist Aug 26, 2015. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions sayHiFactory.js → moduleApi.js
    Original file line number Diff line number Diff line change
    @@ -4,12 +4,12 @@
    * @returns {object}
    */
    function sayHiFactory() {
    var greeting = "Basic module says, 'hallo'!"
    var greeting = "Basic module says, 'hallo'!"

    function prvtWriteToConsole() {
    console.log(greeting);
    }
    function pblcSayHi() {
    function prvtWriteToConsole() {
    console.log(greeting);
    }
    function pblcSayHi() {
    privateWriteToConsole();
    }

  9. cerebrl created this gist Aug 26, 2015.
    21 changes: 21 additions & 0 deletions sayHiFactory.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    /** ****************************************
    * App level module for say hi
    * @module sayHiFactory
    * @returns {object}
    */
    function sayHiFactory() {
    var greeting = "Basic module says, 'hallo'!"

    function prvtWriteToConsole() {
    console.log(greeting);
    }
    function pblcSayHi() {
    privateWriteToConsole();
    }

    return {
    sayHi: pblcSayHi
    };
    }

    // module.exports = sayHiFactory();