'use strict';

angular.module('<%= scriptAppName %>')
  .factory('<%= cameledName %>', function () {
    // Service logic
    // ...

    var meaningOfLife = 42;

    // Public API here
    return {
      someMethod: function () {
        return meaningOfLife;
      }
    };
  });

'use strict';
(function(){

  var <%= cameledName %> = function(){

    var meaningOfLife = 42;

    // Public API here
    return {
      someMethod: someMethod
    };

    //////////////

    function someMethod() {
      return meaningOfLife;
    }
  };

  angular
    .module('<%= scriptAppName %>')
    .factory('<%= cameledName %>', <%= cameledName %>);

}).call(this);
Refactor Javascript Factory to match best practices
Update: Refactor Javascript Factory to match best practices
