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

ES6: migrated "util" #1114

Merged
merged 49 commits into from
Apr 25, 2017
Merged

ES6: migrated "util" #1114

merged 49 commits into from
Apr 25, 2017

Conversation

bennycode
Copy link
Contributor

PromiseQueue.coffee will not be part of this conversion as per request from @gregor (he will convert it later).

@lipis lipis mentioned this pull request Apr 24, 2017
79 tasks
@@ -239,7 +239,7 @@ class z.main.App
if is_reload and error.type not in [z.client.ClientError.TYPE.MISSING_ON_BACKEND, z.client.ClientError.TYPE.NO_LOCAL_CLIENT]
@auth.client.execute_on_connectivity(z.service.Client::CONNECTIVITY_CHECK_TRIGGER.APP_INIT_RELOAD).then -> window.location.reload false
else if navigator.onLine
@logger.error "Caused by: #{error?.message or error}"
@logger.error "Caused by: #{error?.message or error}", error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problematic. If error is a string as it sometimes is and not the error object, we will end up with a log message that does no longer contain the "Caused by reference". Maybe we should be more explicit and do a proper _.isObject check with tow error logging cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this is due to our logger implementation, right?

return undefined;
}

for (let i = next_index; i <= array.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a proper array. We can use that:

for (const item of array) {
  if(!_.isFunction(filter) || !!filter(item)) {
    return item
  }
}

let hash = uint32.toUint32(0);
const key = str.toLowerCase();

for (let i = 0; i <= key.length - 1; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (const index of [0..key.length - 1])

new_array[0] = array[0];
new_array[length - 1] = array[array.length - 1];

for (let i = 1; i < length - 1; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (const index of [0..length - 1])

this.logger = new z.util.Logger('z.util.DebugUtil', z.config.LOGGER.OPTIONS);
this.user_repository = user_repository;

this.get_event_info = this.get_event_info.bind(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for these

return window.URL.revokeObjectURL(object_url);
};
img.onerror = reject;
return img.src = object_url;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No return

return resolve(this.result);
};
reader.onerror = reject;
return reader.readAsArrayBuffer(file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No return

if (typeof xhr_accessor_function === 'function') {
xhr_accessor_function(xhr);
}
return xhr.send();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No return

return resolve([xhr.response, xhr.getResponseHeader('content-type')]);
}
return reject(new Error(`Requesting arraybuffer failed with status ${xhr.status}`));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird empty line

const worker = new window.Worker(uri);
worker.onmessage = (event) => resolve(event.data);
worker.onerror = (error) => reject(error);
return worker.postMessage(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No return

@bennycode bennycode merged commit bba69f4 into dev Apr 25, 2017
@bennycode bennycode deleted the es6/util branch April 25, 2017 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants