Hacker News new | ask | show | jobs
by arcatek 4155 days ago
I use Lodash but i see not point in this announcement in its current form - what changed exactly?

[edit] Changelog is there https://github.com/lodash/lodash/wiki/Changelog

Some decisions sound really weird, such as the fact that forEach is now lazy. It is not a standard replacement anymore, and probably break the compatibility for quite a few apps (even if I'm deeply convinced that we should all use the native functions and shim them when needed).

2 comments

It's only lazy when using the chaining syntax - and that one was never a standard replacement since `_.map(arr, fn)` returns a wrapper around a value and not a value.
Are you talking about this?

    // in 2.4.1
    _([1, 2, 3]).forEach(function(n) { console.log(n); });
    // => logs each value from left to right and returns the lodash wrapper

    // in 3.0.0
    _([1, 2, 3]).forEach(function(n) { console.log(n); });
    // => returns the lodash wrapper without logging until `value` is called
    _([1, 2, 3]).forEach(function(n) { console.log(n); }).value();
    // => logs each value from left to right and returns the array
Seems that the only apps this change will break are those who are using side effects in a chain. Which is a pretty dubious choice, IMO. Especially given that Lodash is a "functional programming library".