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

methodize utility #3

Closed
smith opened this issue Oct 29, 2009 · 9 comments
Closed

methodize utility #3

smith opened this issue Oct 29, 2009 · 9 comments
Labels

Comments

@smith
Copy link

smith commented Oct 29, 2009

This is a feature request: How about a _.methodize() (or some other name) utililty that adds the methods to the native objects?

I know the point of the library is to not extend the native objects, but since all of the methods are defined it would be nice to have a way to make them included.

Please close if you disagree.

@pmuellr
Copy link

pmuellr commented Oct 29, 2009

In this regard, it might be at least useful to add the ES5 Array methods (forEach, etc), if they don't already exist. That's probably where I'd draw the line. _.es5compat() perhaps?

@jashkenas
Copy link
Owner

Hmm. That is indeed the point of having this project. Is there a reason you would use Underscore over Prototype.js in your situation?

If you can make that case, and it can be accomplished in a small amount of code, I'd be glad to take a patch for it.

@jashkenas
Copy link
Owner

For the record:

smith sent you a message.


Subject:

No reason other than underscore is lighter weight than Prototype.js and their isn't a widely used library to bring platforms up to minimal es5 standards that can be implemented in es3.

I'll let you know if I make a patch, but it probably won't happen any time soon.

@jashkenas
Copy link
Owner

I think we would need to take a position one way or another -- either no namespace pollution, or make all of the underscore methods available. There should be no confusion as to which methods exist and which do not -- a big part of structuring Underscore in the way it is in the first place. Underscore could be a good starting point for an "ES5Compat.js", which is something that's very much needed in its own right, just not quite what Underscore is trying to be.

@smith
Copy link
Author

smith commented Oct 29, 2009

Agreed. Was just throwing the idea out there. BTW, I already have a branch of Prototype.js that is a subset and doesn't contain any DOM stuff, in case anyone is interested: http://github.com/smith/prototype-asp

@jashkenas
Copy link
Owner

Great -- that's why it's good to talk about it, and to have this stuff online for reference. I'll close the issue.

@pmuellr
Copy link

pmuellr commented Oct 29, 2009

I think I've changed my mind. ES5Compat.js should probably be something different. And should cover more stuff than the array methods, probably, so even using underscore.js to do it is probably overkill. Besides, who needs ES5Compat.js when there's underscore.js???!!!

@dwt
Copy link

dwt commented Mar 5, 2010

I'd have to to say ES5Compat.js sounds like a nice plugin. :)

@smith
Copy link
Author

smith commented Mar 5, 2010

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants