-
Notifications
You must be signed in to change notification settings - Fork 24
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
Suggestion - Support Extending Objects #7
Comments
Extending native objects in javascript is usually frowned upon. It introduces issue with enumerability etc, but i suppose that could be worked around with defneProperty in newer javascript version. Another solution could be to create a wrapper ala: var values = dottie.wrap({
some: {
nested: {
key: 'foobar';
}
}
}); Although that would probably kill normal object access. |
Yeah, I was thinking of using We could also get fancy and have the users specify what properties the .extend() call would set those helpers to, so users don't have data locations overwritten unexpectedly.
Extending the native Object is frowned upon by some people, but not all. Most of the problems people have with extending native stuff comes from people trying to extend DOM objects (which has a bunch of issues depending on the browser). That's why I was wanting it to be an optional |
Yeah as long as we make the extension explicit and optional i'm all for. Perhaps the default method names should me obj.$get, obj.$set etc - Same short names but most likely no clashes. |
Sure, we can have the defaults be $ by default. I'm not against adding the Since we're good with |
It would be pretty awesome if there was a way of using dottie to extend the native Object prototype. I suggest this because there's a lot of verboicity in
dottie.get(obj, 'some.property')
.If you're OK with doing something like this I can start writing the extension code.
The text was updated successfully, but these errors were encountered: