Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for ngLocale generation #1

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"validateParameterSeparator": ", "
}
File renamed without changes.
5 changes: 3 additions & 2 deletions i18n/src/closureI18nExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function pluralExtractor(content, localeInfo) {
goog.LOCALE = localeIds[i].match(/[^_]+/)[0];
try {
eval(contentText);
} catch(e) {
} catch (e) {
console.log("Error in eval(contentText): " + e.stack);
}
if (!goog.i18n.pluralRules.select) {
Expand All @@ -91,7 +91,8 @@ function pluralExtractor(content, localeInfo) {
replace(/goog\.i18n\.pluralRules\.get_vf_/g, 'getVF').
replace(/goog\.i18n\.pluralRules\.get_wt_/g, 'getWT').
replace(/goog\.i18n\.pluralRules\.decimals_/g, 'getDecimals').
replace(/\n/g, '');
replace(/\n/g, '')
replace(/function \(n/, 'function(n');

///@@ is a crazy place holder to be replaced before writing to file
localeInfo[localeIds[i]].pluralCat = "@@" + temp + "@@";
Expand Down
2 changes: 1 addition & 1 deletion i18n/src/closureSlurper.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function writeLocaleFiles() {
var filename = NG_LOCALE_DIR + 'angular-locale_' + correctedLocaleId + '.js'
console.log('Writing ' + filename);
return qfs.write(filename, content)
.then(function () {
.then(function() {
console.log('Wrote ' + filename);
++num_files;
});
Expand Down
16 changes: 8 additions & 8 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ var VALIDITY_STATE_PROPERTY = 'validity';
* @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;};
var hasOwnProperty = Object.prototype.hasOwnProperty;

/**
Expand All @@ -136,7 +136,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
* @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) {
Expand Down Expand Up @@ -425,7 +425,7 @@ function valueFn(value) {return function() {return value;};}
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is undefined.
*/
function isUndefined(value){return typeof value === 'undefined';}
function isUndefined(value) {return typeof value === 'undefined';}


/**
Expand All @@ -440,7 +440,7 @@ function isUndefined(value){return typeof value === 'undefined';}
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is defined.
*/
function isDefined(value){return typeof value !== 'undefined';}
function isDefined(value) {return typeof value !== 'undefined';}


/**
Expand All @@ -456,7 +456,7 @@ function isDefined(value){return typeof value !== 'undefined';}
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is an `Object` but not `null`.
*/
function isObject(value){
function isObject(value) {
// http://jsperf.com/isobject4
return value !== null && typeof value === 'object';
}
Expand All @@ -474,7 +474,7 @@ function isObject(value){
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `String`.
*/
function isString(value){return typeof value === 'string';}
function isString(value) {return typeof value === 'string';}


/**
Expand All @@ -489,7 +489,7 @@ function isString(value){return typeof value === 'string';}
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Number`.
*/
function isNumber(value){return typeof value === 'number';}
function isNumber(value) {return typeof value === 'number';}


/**
Expand Down Expand Up @@ -535,7 +535,7 @@ var isArray = Array.isArray;
* @param {*} value Reference to check.
* @returns {boolean} True if `value` is a `Function`.
*/
function isFunction(value){return typeof value === 'function';}
function isFunction(value) {return typeof value === 'function';}


/**
Expand Down
2 changes: 1 addition & 1 deletion src/AngularPublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var version = {
};


function publishExternalAPI(angular){
function publishExternalAPI(angular) {
extend(angular, {
'bootstrap': bootstrap,
'copy': copy,
Expand Down
2 changes: 1 addition & 1 deletion src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ function createInjector(modulesToLoad, strictDi) {
////////////////////////////////////
// Module Loading
////////////////////////////////////
function loadModules(modulesToLoad){
function loadModules(modulesToLoad) {
var runBlocks = [], moduleFn;
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
Expand Down
24 changes: 12 additions & 12 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function jqLiteClone(element) {
return element.cloneNode(true);
}

function jqLiteDealoc(element, onlyDescendants){
function jqLiteDealoc(element, onlyDescendants) {
if (!onlyDescendants) jqLiteRemoveData(element);

if (element.querySelectorAll) {
Expand Down Expand Up @@ -493,7 +493,7 @@ var JQLitePrototype = JQLite.prototype = {
},
toString: function() {
var value = [];
forEach(this, function(e){ value.push('' + e);});
forEach(this, function(e) { value.push('' + e);});
return '[' + value.join(', ') + ']';
},

Expand Down Expand Up @@ -584,7 +584,7 @@ forEach({
}
},

attr: function(element, name, value){
attr: function(element, name, value) {
var lowercasedName = lowercase(name);
if (BOOLEAN_ATTR[lowercasedName]) {
if (isDefined(value)) {
Expand Down Expand Up @@ -637,7 +637,7 @@ forEach({
if (isUndefined(value)) {
if (element.multiple && nodeName_(element) === 'select') {
var result = [];
forEach(element.options, function (option) {
forEach(element.options, function(option) {
if (option.selected) {
result.push(option.value || option.text);
}
Expand All @@ -658,7 +658,7 @@ forEach({
},

empty: jqLiteEmpty
}, function(fn, name){
}, function(fn, name) {
/**
* Properties: writes return selection, reads return first value
*/
Expand Down Expand Up @@ -710,7 +710,7 @@ forEach({
});

function createEventHandler(element, events) {
var eventHandler = function (event, type) {
var eventHandler = function(event, type) {
// jQuery specific api
event.isDefaultPrevented = function() {
return event.defaultPrevented;
Expand Down Expand Up @@ -766,7 +766,7 @@ function createEventHandler(element, events) {
forEach({
removeData: jqLiteRemoveData,

on: function jqLiteOn(element, type, fn, unsupported){
on: function jqLiteOn(element, type, fn, unsupported) {
if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');

// Do not add event handlers to non-elements because they will not be cleaned up.
Expand Down Expand Up @@ -836,7 +836,7 @@ forEach({
replaceWith: function(element, replaceNode) {
var index, parent = element.parentNode;
jqLiteDealoc(element);
forEach(new JQLite(replaceNode), function(node){
forEach(new JQLite(replaceNode), function(node) {
if (index) {
parent.insertBefore(node, index.nextSibling);
} else {
Expand All @@ -848,7 +848,7 @@ forEach({

children: function(element) {
var children = [];
forEach(element.childNodes, function(element){
forEach(element.childNodes, function(element) {
if (element.nodeType === NODE_TYPE_ELEMENT)
children.push(element);
});
Expand All @@ -874,7 +874,7 @@ forEach({
prepend: function(element, node) {
if (element.nodeType === NODE_TYPE_ELEMENT) {
var index = element.firstChild;
forEach(new JQLite(node), function(child){
forEach(new JQLite(node), function(child) {
element.insertBefore(child, index);
});
}
Expand Down Expand Up @@ -911,7 +911,7 @@ forEach({

toggleClass: function(element, selector, condition) {
if (selector) {
forEach(selector.split(' '), function(className){
forEach(selector.split(' '), function(className) {
var classCondition = condition;
if (isUndefined(classCondition)) {
classCondition = !jqLiteHasClass(element, className);
Expand Down Expand Up @@ -976,7 +976,7 @@ forEach({
});
}
}
}, function(fn, name){
}, function(fn, name) {
/**
* chaining functions
*/
Expand Down
6 changes: 3 additions & 3 deletions src/minErr.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@

function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
return function () {
return function() {
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
stringify = function (obj) {
stringify = function(obj) {
if (typeof obj === 'function') {
return obj.toString().replace(/ \{[\s\S]*$/, '');
} else if (typeof obj === 'undefined') {
Expand All @@ -49,7 +49,7 @@ function minErr(module, ErrorConstructor) {
},
message, i;

message = prefix + template.replace(/\{\d+\}/g, function (match) {
message = prefix + template.replace(/\{\d+\}/g, function(match) {
var index = +match.slice(1, -1), arg;

if (index + 2 < templateArgs.length) {
Expand Down
4 changes: 2 additions & 2 deletions src/ng/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ var $AnimateProvider = ['$provide', function($provide) {
className = !isString(className)
? (isArray(className) ? className.join(' ') : '')
: className;
forEach(element, function (element) {
forEach(element, function(element) {
jqLiteAddClass(element, className);
});
applyStyles(element, options);
Expand Down Expand Up @@ -289,7 +289,7 @@ var $AnimateProvider = ['$provide', function($provide) {
className = !isString(className)
? (isArray(className) ? className.join(' ') : '')
: className;
forEach(element, function (element) {
forEach(element, function(element) {
jqLiteRemoveClass(element, className);
});
applyStyles(element, options);
Expand Down
2 changes: 1 addition & 1 deletion src/ng/asyncCallback.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

function $$AsyncCallbackProvider(){
function $$AsyncCallbackProvider() {
this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) {
return $$rAF.supported
? function(fn) { return $$rAF(fn); }
Expand Down
8 changes: 4 additions & 4 deletions src/ng/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Browser(window, document, $log, $sniffer) {
// force browser to execute all pollFns - this is needed so that cookies and other pollers fire
// at some deterministic time in respect to the test runner's actions. Leaving things up to the
// regular poller would result in flaky tests.
forEach(pollFns, function(pollFn){ pollFn(); });
forEach(pollFns, function(pollFn) { pollFn(); });

if (outstandingRequestCount === 0) {
callback();
Expand Down Expand Up @@ -114,7 +114,7 @@ function Browser(window, document, $log, $sniffer) {
*/
function startPoller(interval, setTimeout) {
(function check() {
forEach(pollFns, function(pollFn){ pollFn(); });
forEach(pollFns, function(pollFn) { pollFn(); });
pollTimeout = setTimeout(check, interval);
})();
}
Expand Down Expand Up @@ -449,9 +449,9 @@ function Browser(window, document, $log, $sniffer) {

}

function $BrowserProvider(){
function $BrowserProvider() {
this.$get = ['$window', '$log', '$sniffer', '$document',
function($window, $log, $sniffer, $document){
function($window, $log, $sniffer, $document) {
return new Browser($window, $document, $log, $sniffer);
}];
}
8 changes: 4 additions & 4 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
}
// We can not compile top level text elements since text nodes can be merged and we will
// not be able to attach scope data to them, so we will wrap them in <span>
forEach($compileNodes, function(node, index){
forEach($compileNodes, function(node, index) {
if (node.nodeType == NODE_TYPE_TEXT && node.nodeValue.match(/\S+/) /* non-empty */ ) {
$compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
}
Expand All @@ -1153,7 +1153,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
maxPriority, ignoreDirective, previousCompileContext);
compile.$$addScopeClass($compileNodes);
var namespace = null;
return function publicLinkFn(scope, cloneConnectFn, transcludeControllers, parentBoundTranscludeFn, futureParentElement){
return function publicLinkFn(scope, cloneConnectFn, transcludeControllers, parentBoundTranscludeFn, futureParentElement) {
assertArg(scope, 'scope');
if (!namespace) {
namespace = detectNamespaceForChildElements(futureParentElement);
Expand Down Expand Up @@ -2500,15 +2500,15 @@ function nodesetLinkingFn(
/* NodeList */ nodeList,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
) {}

function directiveLinkingFn(
/* nodesetLinkingFn */ nodesetLinkingFn,
/* angular.Scope */ scope,
/* Node */ node,
/* Element */ rootElement,
/* function(Function) */ boundTranscludeFn
){}
) {}

function tokenDifference(str1, str2) {
var values = '',
Expand Down
2 changes: 1 addition & 1 deletion src/ng/directive/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var htmlAnchorDirective = valueFn({
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
'xlink:href' : 'href';
element.on('click', function(event){
element.on('click', function(event) {
// if we have no href url, then don't navigate anywhere.
if (!element.attr(href)) {
event.preventDefault();
Expand Down
6 changes: 3 additions & 3 deletions src/ng/directive/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
* Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
* saving or resetting it.
*/
form.$setPristine = function () {
form.$setPristine = function() {
$animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
form.$dirty = false;
form.$pristine = true;
Expand All @@ -255,7 +255,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
* Setting a form controls back to their untouched state is often useful when setting the form
* back to its pristine state.
*/
form.$setUntouched = function () {
form.$setUntouched = function() {
forEach(controls, function(control) {
control.$setUntouched();
});
Expand All @@ -268,7 +268,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
* @description
* Sets the form to its submitted state.
*/
form.$setSubmitted = function () {
form.$setSubmitted = function() {
$animate.addClass(element, SUBMITTED_CLASS);
form.$submitted = true;
parentForm.$setSubmitted();
Expand Down
Loading