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

Code cleanup #1

Open
Eeems opened this issue Jan 19, 2015 · 1 comment
Open

Code cleanup #1

Eeems opened this issue Jan 19, 2015 · 1 comment
Assignees

Comments

@Eeems
Copy link

Eeems commented Jan 19, 2015

I've noticed a couple places where you do:

var variable = input_text.replace();
variable = variable.replace():
variable = variable.replace():

While this works, it's a little less efficient then just chaining the replaces together, like this:

var variable = input_text.replace()
    .replace()
    .replace();

public/parse.js#L15

I've also noticed a ton of this:

var variable = "some text";
variable += "some more text";
variable += "some more text";

Which can be replaced with something similar to this:

var variable = "some text"+
    "some more text"+
    "some more text";

It should be easy enough to read, plus it also will perform a tiny bit faster due to not having to figure out variable references etc.
public/main.js#L21
public/main.js#L37
public/main.js#L53
public/parse.js#96

@juju2143
Copy link
Owner

I stole the parser.js code from OmnomIRC as is (well, stole, it's under GPL and it's properly credited), but yeah I should totally clean that code with something more efficient. (Why did I even do that, especially the 2nd point you made o.o)

@juju2143 juju2143 self-assigned this Jan 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants