Live data from Hacker News

Lodash v3.0.0

lodash.com

61–70 of 82 posts

Re: Lodash v3.0.0

#61
post #43
post #36

Earlier quoted context omitted.

It's extra stuff that should be in the standard library but isn't. These days, a lot of it is actually in the standard library - for example, array maps - and invoking lodash just calls the es5/es6 built in, with a slightly uglier syntax.

The most important feature is chaining and lazy evaluation. I think the most useful functions are the typechecking utilities (typeof in javascript is the most useless keyword the human kind engineered in a language). In the end is a very nice library to work with when it does not get in the way (of course, if you are using `_.each([], fn)`, you should think again and use `Array#forEach` or a nice `for`)

>of course, if you are using `_.each([], fn)`, you should think again and use `Array#forEach` or a nice `for`

You probably shouldn't if you're in a hot path. LoDash actually outperforms some native ES5 features, Array#forEach being one of them IIRC.

Re: Lodash v3.0.0

#62
I've tended to avoid both underscore and lodash because they're both in the slew of monolithic pre-npm libraries, however the lazy evaluation looks interesting. I wouldn't be surprised to find a library that handles lazy eval without all the extra features Lodash brings.

Re: Lodash v3.0.0

#64

I've tended to avoid both underscore and lodash because they're both in the slew of monolithic pre-npm libraries, however the lazy evaluation looks interesting. I wouldn't be surprised to find a library that handles lazy eval without all the extra features Lodash brings.

For the shops who don't live and breath js and whose js work is almost entirely browser-based, these monoliths are great. I, for one, am bummed that the js market is moving away from monoliths. e.g. YUI shutting down.

Re: Lodash v3.0.0

#65

I've tended to avoid both underscore and lodash because they're both in the slew of monolithic pre-npm libraries, however the lazy evaluation looks interesting. I wouldn't be surprised to find a library that handles lazy eval without all the extra features Lodash brings.

There is lazy.js (http://danieltao.com/lazy.js/). Also, lodash is highly factored into pieces if you don't want the whole thing.

Re: Lodash v3.0.0

#66
post #49
post #9

Earlier quoted context omitted.

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

There is an excellent talk called "Underscore, you're doing it wrong!". The talk explains how well designed param order with currying leads to very short and expressive code -- and how underscore missed the boat. This aspect of it should be interesting as it's related to this post. It's well worth the watch. https://www.youtube.com/watch?v=m3svKOdZijA

I was just about to post exactly this. Well worth a watch. It was this talk which finally made currying "click" for me. And serendipitously the topic is the improvements currying and swapping args can make to the underscore (or lodash!) API.

I even tweeted to @jdalton on announcement "hey lodash, you're doing it right" :)

Re: Lodash v3.0.0

#67

I've tended to avoid both underscore and lodash because they're both in the slew of monolithic pre-npm libraries, however the lazy evaluation looks interesting. I wouldn't be surprised to find a library that handles lazy eval without all the extra features Lodash brings.

With browserify (or webpack) you can require just the functions you want, and only those (and their dependencies) end up in your code base. This is covered in the changelog

Re: Lodash v3.0.0

#68
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

Coming from a Python background, Ramda's (function, iterable) feels way more natural than vice-versa:

https://docs.python.org/2/library/functions.html#map

Re: Lodash v3.0.0

#69
post #9
post #4

Really nice to see that there's now an auto-curried, function-first version, lodash-fp! I've been really attracted by Ramda JS recently for this reason. https://www.npmjs.com/package/lodash-fp

I've been looking for some real-world examples of how currying might be useful in javascript. Haven't not used a language which supports currying for any real world project, I'm interested to know how it can help. I found a page [1] which talks about currying in javascript, then says "Are there practical uses for currying in JavaScript? Not really." Can you point me at anything which will help me see why it's useful?…

[deleted]

Re: Lodash v3.0.0

#70
post #53

So going modern means breaking in PhantomJS, that is a bummer.

It doesn't mean it's breaking in PhantomJS. The modern build lacks some iteration fixes for older environments is all. In the case of PhantomJS it's edge iteration of things like `arguments` objects. The modern build won't error out even in IE6.
Post reply on HN