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

mv try catch out of main function #3

Closed
wants to merge 5 commits into from
Closed

mv try catch out of main function #3

wants to merge 5 commits into from

Conversation

coderaiser
Copy link

Moved try-catch to another function to improve speed.
Callback called twice when error occur:

  • with first argument error
  • with first argument undefined

Optimization killers

@shinnn
Copy link
Contributor

shinnn commented Dec 16, 2014

Looks good.
How about using tryit to keep modularity?

@coderaiser
Copy link
Author

Done.

var json;

if (!error)
error = tryit(function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

error = is not needed since tryit doesn't return any values.

https://github.com/HenrikJoreteg/tryit/blob/master/tryit.js

@coderaiser
Copy link
Author

Done.

@azer
Copy link
Owner

azer commented Oct 2, 2015

Hi all,

sorry for late reply. I saw this PR before but didn't know how to respond as it's doing multiple things in one PR and I'm not sure what you mean by;

with first argument error
with first argument undefined

Does it have a bug that I'm not realizing ? Or are you just moving try-catch for optimization ?

@azer azer closed this Oct 10, 2015
@azer
Copy link
Owner

azer commented Oct 10, 2015

It's done with try-call module now; https://github.com/azer/read-json/blob/master/index.js#L14

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.

3 participants