Skip to content

Add length as a property instead a method#8

Open
mgesmundo wants to merge 1 commit intojhuckaby:masterfrom
mgesmundo:length-as-property
Open

Add length as a property instead a method#8
mgesmundo wants to merge 1 commit intojhuckaby:masterfrom
mgesmundo:length-as-property

Conversation

@mgesmundo
Copy link
Copy Markdown

This small PR add length as a property instead a method, like the ES6 Map.
Thank you for your useful module!
All the best

@jhuckaby
Copy link
Copy Markdown
Owner

Thank you very much for this PR. It's a very clever trick. You'll have to forgive me, but since this module is already in active use in so many places (including many of my own projects) I really don't want to introduce a "breaking change" to the API like this. I have code that is "relying" on length() being a method, and changing it to a property would bust all that code.

You are absolutely correct here, and this is very much the way I SHOULD have designed it from the start. Your way matches the ES6 Map spec exactly, which I was trying to mostly emulate. I wish I knew about this nifty trick at the time.

I might revisit this for a future v2.0 rewrite, when I can freely break the API, but for v1.x, I have to keep it locked down.

But seriously, thank you for the contribution!

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