From fd822bdaf9d04e522aaa5400b673f333190abe98 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 7 Oct 2011 11:27:49 -0700 Subject: chore(formating): clean code to be function() { --- src/Angular.js | 26 ++++++++++----------- src/Browser.js | 6 ++--- src/Injector.js | 2 +- src/Resource.js | 2 +- src/Scope.js | 4 ++-- src/angular-mocks.js | 16 ++++++------- src/angular.suffix | 2 +- src/apis.js | 16 ++++++------- src/directives.js | 42 +++++++++++++++++----------------- src/filters.js | 26 ++++++++++----------- src/jqLite.js | 2 +- src/parser.js | 48 +++++++++++++++++++-------------------- src/sanitizer.js | 2 +- src/scenario/Scenario.js | 2 +- src/scenario/angular-bootstrap.js | 4 ++-- src/service/cookies.js | 2 +- src/service/formFactory.js | 24 ++++++++++---------- src/service/log.js | 2 +- src/service/resource.js | 4 ++-- src/service/route.js | 2 +- src/service/routeParams.js | 2 +- src/service/xhr.bulk.js | 2 +- src/service/xhr.js | 2 +- src/widget/form.js | 6 ++--- src/widget/input.js | 24 ++++++++++---------- src/widget/select.js | 36 ++++++++++++++--------------- src/widgets.js | 44 +++++++++++++++++------------------ 27 files changed, 175 insertions(+), 175 deletions(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index 7c218c6e..9b651fce 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -14,7 +14,7 @@ if (typeof document.getAttribute == $undefined) * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ -var lowercase = function (string){ return isString(string) ? string.toLowerCase() : string; }; +var lowercase = function(string){ return isString(string) ? string.toLowerCase() : string; }; /** @@ -26,17 +26,17 @@ var lowercase = function (string){ return isString(string) ? string.toLowerCase( * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ -var uppercase = function (string){ return isString(string) ? string.toUpperCase() : string; }; +var uppercase = function(string){ return isString(string) ? string.toUpperCase() : string; }; -var manualLowercase = function (s) { +var manualLowercase = function(s) { return isString(s) - ? s.replace(/[A-Z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) + ? s.replace(/[A-Z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) | 32); }) : s; }; -var manualUppercase = function (s) { +var manualUppercase = function(s) { return isString(s) - ? s.replace(/[a-z]/g, function (ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) + ? s.replace(/[a-z]/g, function(ch) {return fromCharCode(ch.charCodeAt(0) & ~32); }) : s; }; @@ -239,7 +239,7 @@ function extend(dst) { function inherit(parent, extra) { - return extend(new (extend(function(){}, {prototype:parent}))(), extra); + return extend(new (extend(function() {}, {prototype:parent}))(), extra); } @@ -279,11 +279,11 @@ function noop() {} function identity($) {return $;} -function valueFn(value) {return function(){ return value; };} +function valueFn(value) {return function() { return value; };} function extensionMap(angular, name, transform) { var extPoint; - return angular[name] || (extPoint = angular[name] = function (name, fn, prop){ + return angular[name] || (extPoint = angular[name] = function(name, fn, prop){ name = (transform || identity)(name); if (isDefined(fn)) { extPoint[name] = extend(fn, prop || {}); @@ -604,12 +604,12 @@ function isLeafNode (node) { * * @@ -612,7 +612,7 @@ var angularArray = { @@ -209,7 +209,7 @@ angularDirective("ng:controller", function(expression){ - it('should check ng:bind', function(){ + it('should check ng:bind', function() { expect(using('.doc-example-live').binding('name')).toBe('Whirled'); using('.doc-example-live').input('name').enter('world'); expect(using('.doc-example-live').binding('name')).toBe('world'); @@ -326,7 +326,7 @@ function compileBindTemplate(template){ @@ -413,7 +413,7 @@ angularDirective("ng:bind-template", function(expression, element){ - it('should check ng:bind-attr', function(){ + it('should check ng:bind-attr', function() { expect(using('.doc-example-live').element('a').attr('href')). toBe('http://www.google.com/search?q=AngularJS'); using('.doc-example-live').input('query').enter('google'); @@ -471,7 +471,7 @@ angularDirective("ng:bind-attr", function(expression){ count: {{count}} - it('should check ng:click', function(){ + it('should check ng:click', function() { expect(binding('count')).toBe('0'); element('.doc-example-live :button').click(); expect(binding('count')).toBe('1'); @@ -516,10 +516,10 @@ angularDirective("ng:click", function(expression, element){ @@ -60,11 +60,11 @@ - it('should init with 1234.56', function(){ + it('should init with 1234.56', function() { expect(binding('amount | currency')).toBe('$1,234.56'); expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); }); - it('should update', function(){ + it('should update', function() { input('amount').enter('-1234'); expect(binding('amount | currency')).toBe('($1,234.00)'); expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); @@ -101,7 +101,7 @@ angularFilter.currency = function(amount, currencySymbol){ @@ -113,13 +113,13 @@ angularFilter.currency = function(amount, currencySymbol){ - it('should format numbers', function(){ + it('should format numbers', function() { expect(binding('val | number')).toBe('1,234.568'); expect(binding('val | number:0')).toBe('1,235'); expect(binding('-val | number:4')).toBe('-1,234.5679'); }); - it('should update', function(){ + it('should update', function() { input('val').enter('3374.333'); expect(binding('val | number')).toBe('3,374.333'); expect(binding('val | number:0')).toBe('3,374'); @@ -336,7 +336,7 @@ var GET_TIME_ZONE = /[A-Z]{3}(?![+\-])/, {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
- it('should format date', function(){ + it('should format date', function() { expect(binding("1288323623006 | date:'medium'")). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). @@ -477,7 +477,7 @@ angularFilter.uppercase = uppercase; @@ -41,12 +41,12 @@ - it('should initialize to model', function(){ + it('should initialize to model', function() { expect(binding('text')).toEqual('guest'); expect(binding('myForm.input.$valid')).toEqual('true'); }); - it('should be invalid if empty', function(){ + it('should be invalid if empty', function() { input('text').enter(''); expect(binding('text')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); diff --git a/src/widget/input.js b/src/widget/input.js index f82027f4..18d1ae12 100644 --- a/src/widget/input.js +++ b/src/widget/input.js @@ -25,7 +25,7 @@ var INTEGER_REGEXP = /^\s*(\-|\+)?\d+\s*$/; @@ -155,7 +155,7 @@ angularInputType('email', function() { @@ -222,7 +222,7 @@ angularInputType('url', function() { @@ -295,7 +295,7 @@ angularInputType('list', function() { @@ -359,7 +359,7 @@ angularInputType('number', numericRegexpInputType(NUMBER_REGEXP, 'NUMBER')); @@ -418,7 +418,7 @@ angularInputType('integer', numericRegexpInputType(INTEGER_REGEXP, 'INTEGER')); @@ -604,7 +604,7 @@ var HTML5_INPUTS_TYPES = makeMap( @@ -635,7 +635,7 @@ var HTML5_INPUTS_TYPES = makeMap( */ -angularWidget('input', function (inputElement){ +angularWidget('input', function(inputElement){ this.directives(true); this.descend(true); var modelExp = inputElement.attr('ng:model'); @@ -715,7 +715,7 @@ angularWidget('input', function (inputElement){ } }); - forEach(['valid', 'invalid', 'pristine', 'dirty'], function (name) { + forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) { widget.$watch('$' + name, function(scope, value) { inputElement[value ? 'addClass' : 'removeClass']('ng-' + name); } diff --git a/src/widget/select.js b/src/widget/select.js index f397180e..1687721c 100644 --- a/src/widget/select.js +++ b/src/widget/select.js @@ -66,7 +66,7 @@
overview | @@ -533,7 +533,7 @@ angularWidget("@ng:non-bindable", noop);
- it('should load templates', function(){ + it('should load templates', function() { element('.doc-example-live a:contains(overview)').click(); expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Overview/); @@ -552,11 +552,11 @@ angularWidget('ng:view', function(element) { var template; var changeCounter = 0; - this.$on('$afterRouteChange', function(){ + this.$on('$afterRouteChange', function() { changeCounter++; }); - this.$watch(function(){return changeCounter;}, function() { + this.$watch(function() {return changeCounter;}, function() { var template = $route.current && $route.current.template; if (template) { //xhr's callback must be async, see commit history for more info @@ -669,7 +669,7 @@ angularWidget('ng:view', function(element) {