jshint: reduced cyclomatic complexity of a method