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

avoid adding an entry and removing it immeadiatly #1

Open
derhuerst opened this issue Sep 6, 2015 · 2 comments
Open

avoid adding an entry and removing it immeadiatly #1

derhuerst opened this issue Sep 6, 2015 · 2 comments

Comments

@derhuerst
Copy link
Owner

This is inefficient. The unit test could maybe use ES6 Array.prototype.observe.

@brianshaler
Copy link
Contributor

Why not just return at if (i>=0)?

So this..

if (i >= 0) this.data.splice(i, 1); // delete

becomes this..

if (i >= 0) return this;

(or if my pull request is merged, if (i >= 0) return;)

@derhuerst
Copy link
Owner Author

@brianshaler

This doesn't work. The passed value (entry) needs to be lower than the lowest value (this.data[this.data.length - 1]).

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

No branches or pull requests

2 participants