Skip to content

Allow isReserved() to handle numeric inputs #772

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

Closed
wants to merge 2 commits into from

Conversation

njovin
Copy link

@njovin njovin commented Apr 8, 2015

Currently, when an object has numeric keys and you try to $add or $delete any of those keys, an error is thrown since isReserved is expecting a string. If this function is allowed to return false when a numeric key is passed to it, the delete operation works as expected.

…when an int is passed when dealing with numerically-keyed objects
@yyx990803
Copy link
Member

It's probably easier to just cast the argument into a string (str = '' + str), and that would also handle more types than just numbers and strings.

@njovin
Copy link
Author

njovin commented Apr 14, 2015

Yep, that's the better solution. Pull request modified.

@yyx990803
Copy link
Member

Looks good now, but can you submit against dev branch instead? master is only updated when there's a release.

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