angular-styleguide icon indicating copy to clipboard operation
angular-styleguide copied to clipboard

Y022 - Naming Conventions For Functions Inside IIFE

Open johnjspiteri opened this issue 7 years ago • 1 comments

Are named functions used in this pattern solely for easier debugging?

/* recommended */
angular
    .module('app')
    .controller('SomeController', SomeController);

function SomeController() { }

I have been using an internal naming convention to easier isolate the controller name when fuzzy searching:

angular
    .module('app')
    .controller('SomeController', Internal);

Internal.$inject = [];

function Internal() { }

johnjspiteri avatar Apr 17 '17 17:04 johnjspiteri

Same naming for injector and function name also help a lot when you want to rename something.

MarcLoupias avatar May 17 '17 12:05 MarcLoupias