Commit 9d27117f authored by Pascal Hartig's avatar Pascal Hartig

sapui5: code style fixes

parent e7fbe334
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
this.name = aName; this.name = aName;
}; };
todo.TodoPersistency.prototype = function () { todo.TodoPersistency.prototype = (function () {
var storage = window.localStorage; var storage = window.localStorage;
return { return {
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
return !(this.get()); return !(this.get());
} }
}; };
}(); }());
})(); })();
...@@ -10,55 +10,55 @@ ...@@ -10,55 +10,55 @@
jQuery.sap.declare('todo.formatters'); jQuery.sap.declare('todo.formatters');
todo.formatters = { todo.formatters = {
// Returns whether all todos are completed // Returns whether all todos are completed
allCompletedTodosFormatter: function (aTodos) { allCompletedTodosFormatter: function (aTodos) {
return !(aTodos.some(function (element, index, array) { return !(aTodos.some(function (element, index, array) {
return element.done === false; return element.done === false;
})); }));
}, },
// Converts booleans to strings // Converts booleans to strings
booleanToStringFormatter: function (value) { booleanToStringFormatter: function (value) {
if (value === true) { if (value === true) {
return 'true'; return 'true';
} }
return 'false'; return 'false';
}, },
// Counts the number of closed todos // Counts the number of closed todos
completedTodoCountFormatter: function (aTodos) { completedTodoCountFormatter: function (aTodos) {
var numberOfCompletedItems = 0; var numberOfCompletedItems = 0;
aTodos.forEach(function (todo) { aTodos.forEach(function (todo) {
if (todo.done === true) { if (todo.done === true) {
numberOfCompletedItems++; numberOfCompletedItems++;
} }
}); });
return 'Clear completed (' + numberOfCompletedItems + ')'; return 'Clear completed (' + numberOfCompletedItems + ')';
}, },
// Returns whether a completed todo is available // Returns whether a completed todo is available
hasCompletedTodosFormatter: function (aTodos) { hasCompletedTodosFormatter: function (aTodos) {
return aTodos.some(function (element, index, array) { return aTodos.some(function (element, index, array) {
return element.done === true; return element.done === true;
}); });
}, },
// Returns whether a an array has elements // Returns whether a an array has elements
isArrayNonEmptyFormatter: function (aTodos) { isArrayNonEmptyFormatter: function (aTodos) {
return aTodos.length > 0; return aTodos.length > 0;
}, },
// Counts the number of open todos // Counts the number of open todos
openTodoCountFormatter: function (aTodos) { openTodoCountFormatter: function (aTodos) {
var numberOfOpenItems = 0; var numberOfOpenItems = 0;
aTodos.forEach(function (todo) { aTodos.forEach(function (todo) {
if (todo.done === false) { if (todo.done === false) {
numberOfOpenItems++; numberOfOpenItems++;
} }
}); });
return numberOfOpenItems === 1 ? '1 item left' : numberOfOpenItems + ' items left'; return numberOfOpenItems === 1 ? '1 item left' : numberOfOpenItems + ' items left';
} }
}; };
})(); })();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment