Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

[CLEANUP] eslint operator-linebreak #773

Merged
merged 1 commit into from
Oct 27, 2016
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/components/date-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export default HtmlInput.extend({
_picker: null,

_shouldSetDate: function(currentDate, picker) {
return (picker && (Ember.isEmpty(currentDate) ||
Ember.isEmpty(picker.getDate()) ||
(currentDate.getTime && picker.getDate().getTime() !== currentDate.getTime())));
return (picker && (Ember.isEmpty(currentDate)
|| Ember.isEmpty(picker.getDate())
|| (currentDate.getTime && picker.getDate().getTime() !== currentDate.getTime())));
},

currentDateChangedValue: function() {
Expand Down
6 changes: 3 additions & 3 deletions app/mixins/dob-days.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default Ember.Mixin.create({
}
if (birthDate.getFullYear !== undefined) {
years = today.getFullYear() - birthDate.getFullYear();
if (today.getMonth() < birthDate.getMonth() ||
(today.getMonth() === birthDate.getMonth() &&
today.getDate() < birthDate.getDate())) {
if (today.getMonth() < birthDate.getMonth()
|| (today.getMonth() === birthDate.getMonth()
&& today.getDate() < birthDate.getDate())) {
years--;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/mixins/inventory-locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default Ember.Mixin.create({
let aisleToFind = this.get('aisleToFind');
let itemLocation = inventoryLocation.get('location');
let locationToFind = this.get('locationToFind');
if ((Ember.isEmpty(aisleLocation) && Ember.isEmpty(aisleToFind) || aisleLocation === aisleToFind) &&
(Ember.isEmpty(itemLocation) && Ember.isEmpty(locationToFind) || itemLocation === locationToFind)) {
if ((Ember.isEmpty(aisleLocation) && Ember.isEmpty(aisleToFind) || aisleLocation === aisleToFind)
&& (Ember.isEmpty(itemLocation) && Ember.isEmpty(locationToFind) || itemLocation === locationToFind)) {
return true;
}
},
Expand Down
8 changes: 4 additions & 4 deletions app/services/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default Ember.Service.extend(PouchAdapterUtils, {
timeout: 30000
};
// If we don't have the proper credentials, throw error to force login.
if (Ember.isEmpty(configs.config_consumer_key) ||
Ember.isEmpty(configs.config_consumer_secret) ||
Ember.isEmpty(configs.config_oauth_token) ||
Ember.isEmpty(configs.config_token_secret)) {
if (Ember.isEmpty(configs.config_consumer_key)
|| Ember.isEmpty(configs.config_consumer_secret)
|| Ember.isEmpty(configs.config_oauth_token)
|| Ember.isEmpty(configs.config_token_secret)) {
throw Error('login required');
} else {
let headers = {
Expand Down
4 changes: 2 additions & 2 deletions app/serviceworkers/pouchdb-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function setupRemoteSync() {
timeout: 30000
}
};
if (configs.config_consumer_secret && configs.config_token_secret &&
configs.config_consumer_key && configs.config_oauth_token) {
if (configs.config_consumer_secret && configs.config_token_secret
&& configs.config_consumer_key && configs.config_oauth_token) {
pouchOptions.ajax.headers['x-oauth-consumer-secret'] = configs.config_consumer_secret;
pouchOptions.ajax.headers['x-oauth-consumer-key'] = configs.config_consumer_key;
pouchOptions.ajax.headers['x-oauth-token-secret'] = configs.config_token_secret;
Expand Down
112 changes: 56 additions & 56 deletions app/utils/pouch-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,67 +48,67 @@ function checkForUpdate(view, db, runningTest, testDumpFile) {
}

function generateSortFunction(sortFunction, includeCompareDate, filterFunction) {
let generatedFunction = 'function(head, req) {' +
'function keysEqual(keyA, keyB) {' +
'for (var i= 0; i < keyA.length; i++) {' +
'if (keyA[i] !== keyB[i]) {' +
'return false;' +
'}' +
'}' +
'return true;' +
'}';
let generatedFunction = 'function(head, req) {'
+ 'function keysEqual(keyA, keyB) {'
+ 'for (var i= 0; i < keyA.length; i++) {'
+ 'if (keyA[i] !== keyB[i]) {'
+ 'return false;'
+ '}'
+ '}'
+ 'return true;'
+ '}';
if (includeCompareDate) {
generatedFunction += 'function getCompareDate(dateString) {' +
'if (!dateString || dateString === "") {' +
'return 0;' +
'}' +
'return new Date(dateString).getTime();' +
'}';
generatedFunction += 'function getCompareDate(dateString) {'
+ 'if (!dateString || dateString === "") {'
+ 'return 0;'
+ '}'
+ 'return new Date(dateString).getTime();'
+ '}';
}
generatedFunction += 'function compareStrings(aString, bString) {' +
'if (!aString) {' +
'aString = "";' +
'}' +
'if (!bString) {' +
'bString = "";' +
'}' +
'if (aString < bString) {' +
'return -1;' +
'} else if (aString > bString) {' +
'return 1;' +
'} else {' +
'return 0;' +
'}' +
'}' +
'var row,' +
'rows=[],' +
'startingPosition = 0;' +
'while(row = getRow()) {' +
'rows.push(row);' +
'}';
generatedFunction += 'function compareStrings(aString, bString) {'
+ 'if (!aString) {'
+ 'aString = "";'
+ '}'
+ 'if (!bString) {'
+ 'bString = "";'
+ '}'
+ 'if (aString < bString) {'
+ 'return -1;'
+ '} else if (aString > bString) {'
+ 'return 1;'
+ '} else {'
+ 'return 0;'
+ '}'
+ '}'
+ 'var row,'
+ 'rows=[],'
+ 'startingPosition = 0;'
+ 'while(row = getRow()) {'
+ 'rows.push(row);'
+ '}';
if (filterFunction) {
generatedFunction += `rows = rows.filter(${filterFunction});`;
}
generatedFunction += `rows.sort(${sortFunction});` +
'if (req.query.sortDesc) {' +
'rows = rows.reverse();' +
'}' +
'if (req.query.sortStartKey) {' +
'var startKey = JSON.parse(req.query.sortStartKey);' +
'for (var i=0; i<rows.length; i++) {' +
'if (keysEqual(startKey, rows[i].key)) {' +
'startingPosition = i;' +
'break;' +
'}' +
'}' +
'}' +
'if (req.query.sortLimit) {' +
'rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);' +
'} else if (startingPosition > 0) {' +
'rows = rows.slice(startingPosition);' +
'}' +
'send(JSON.stringify({"rows" : rows}));' +
'}';
generatedFunction += `rows.sort(${sortFunction});`
+ 'if (req.query.sortDesc) {'
+ 'rows = rows.reverse();'
+ '}'
+ 'if (req.query.sortStartKey) {'
+ 'var startKey = JSON.parse(req.query.sortStartKey);'
+ 'for (var i=0; i<rows.length; i++) {'
+ 'if (keysEqual(startKey, rows[i].key)) {'
+ 'startingPosition = i;'
+ 'break;'
+ '}'
+ '}'
+ '}'
+ 'if (req.query.sortLimit) {'
+ 'rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);'
+ '} else if (startingPosition > 0) {'
+ 'rows = rows.slice(startingPosition);'
+ '}'
+ 'send(JSON.stringify({"rows" : rows}));'
+ '}';
return generatedFunction;
}

Expand Down