3 ms·
And if you don't want to add dependency on a whole framework just for that little bit of functionality? It's useful to know how to implement it on its own.
by gliese1337 14y ago
And if you don't want to add dependency on a whole framework just for that little bit of functionality? It's useful to know how to implement it on its own.
- vmind 14y agoWell the example given is bugged, as if you make updates at 0 and 50, then it never fires the function at 100 for the change that occurred at 50. If I didn't want to rely on the whole framework, I'd copy and paste the tested implementation (and dependencies) in underscore. Not that it's bad to know how to do it yourself, but I'd make sure my implementation was sound before sharing it as advice.
- WiseWeasel 14y agoUnderscore is tiny, and there are lots of other goodies you'll probably want to use in there if you look, like _.each(), _.defer(), _.pluck(), _.escape(), and so many more; totally worth it. I installed underscore for backbone, and I have a hard time imagining life without it now, even if I didn't use backbone.
- dagw 14y agoWhen I'm writing actual web sites I always include underscore. However when writing libraries that I want to distribute on their own I don't want to force unnecessary third party dependencies on end users if it can be avoided. In those cases I have pulled out a single underscores function that I happened to need.