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

Deque doesn't expose length #3

Open
ryankaplan opened this issue Nov 13, 2015 · 3 comments
Open

Deque doesn't expose length #3

ryankaplan opened this issue Nov 13, 2015 · 3 comments

Comments

@ryankaplan
Copy link

Hi @petkaantonov -

I'd like to be able to iterate over the elements in a queue without converting it to an array. To do this I need to expose Deque's length attribute (i.e. change it from _length to length). I'd be happy to submit a PR for this if you think it's a reasonable change. Please let me know.

Ryan

@petkaantonov
Copy link
Owner

Yes I am surprised it's not implemented :) go for it

@ryankaplan
Copy link
Author

Ah whoops. It's implemented as follows.

Object.defineProperty(Deque.prototype, "length", {
    get: function() {
        return this._length;
    },
    set: function() {
        throw new RangeError("");
    }
});

I missed that. Never mind!

@TazmanianDI
Copy link

Hrmmm, I thought this was missing as well. Seems like an oversight in the documentation.

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

3 participants