Closed jdalton closed 6 years ago
Any updates on this?
Any update. I need some of LoDash's methods, including _.cloneDeep()
In Meteor, you probably want EJSON.clone.
Lodash continues to be something I/we are curious about but never seems to rise to the priority level of, eg, making the Mongo connector scale better. Maybe next bug week.
Thanks very much, David. I wasn't aware of EJSON.clone.
Thanks for the interest in lodash. Let me know if you all revisit the issue in the future.
Hi, JDalton,
I am confident the Meteor Devs (also known as MDG, for Meteor Developer Group) will no doubt add LoDash to Meteor. But they started with Underscore as the safe bet at the time, I suppose. On top of that, I think they like to do their due diligence to make sure any package they add to the core Meteor platform is sufficiently tested and reliably integrated.
Therefore, I think they really just need a little push and the the time to include LoDash, but they wouldn't act unless there is enough interest. And based on the activity on this Github issue, there is not enough interest to rise to "sufficient."
LoDash is amazing and incredibly useful, btw. I have been using it with Backbone and Ember. And now that I am using Meteor, I expect to continue to use it. Thanks for your work on LoDash.
Lodash looks great. But just like every time we upgrade a Node minor version, the day I swap in lodash will be a day where I do a full automated and manual QA of Meteor. Which is something we're trying to make more and more automated, but we're not there yet.
Minor underscore version bumps have caused regressions for Meteor. Swapping out the entire implementation probably will too. (Usually it's a a matter of a place where Meteor needs an improvement because it was using Underscore wrong.)
+1
+1
Doing some benchmarks and profiling most time in our application is spent on underscore (and minimongo). So I am sure performance of many applications could be improved by switching. See the lodash website for in-depth benchmarks.
+1
:+1:
+1
+1
:+1:
+1
+1
On Sun, Mar 16, 2014 at 5:15 PM, Fabian Vogelsteller < notifications@github.com> wrote:
+1
Reply to this email directly or view it on GitHubhttps://github.com/meteor/meteor/issues/1009#issuecomment-37768810 .
+1
+1
+1
+1
I find lodash a great replacement for underscore, and use it whenever I can. I'm having problems fitting it into Meteor though, due to that integrating underscore already :(
+1
Voting for this too. Lodash is better and more reliable.
I want Lodash too please!
+1
+1
By the way. You can use Lodash instead of Underscore for your own code without problems. Just remove the dependency on standard-app-package and depend on the listed packages instead (select the release version you use). Make sure to remove underscore from your package.js. Then you can use the Lodash atmosphere package with mrt add lodash
(or create your own).
I hope that helps some people, because I myself realised it quite late that there is no namespace conflict with _
because of the way that Meteor bundles the packages.
+1
+1
+1
Replacing underscore with lodash can easily be achieved using the following approach:
mrt add lodash
_ = lodash;
Though that also means that underscore is still loaded but later replaced by lodash.
+1
+1
+1
+1
+1
+4
+1
+1
+1
+1
+1
:+1: for the :heart: of :godmode:
+1
+1
Lots of people have been +1'ing this ticket, looks like people really want this. As Glasser describes, this isn't a trivial update. To help us prioritize, it would help to understand what particular problems you are having that switching to Lo-Dash helps with. Can some of the +1'ers elaborate?
@avital The problem I had with underscore was https://github.com/meteor/meteor/issues/594 - Using _.each for an universal iterator had its issues - it ended when @glasser wrote a modified version of each to solve this. Imho it would have made more sense to use the lodash iterators instead. (more details in #594) - I do fully understand the implications switching regarding QA etc. a scary job.
I've tried to highlight the pro/cons/status in https://github.com/raix/Meteor-community-discussions/issues/8 and keep a track of things.
@avital As for me, the biggest advantage is speed. I believe this is mostly because Lo-Dash uses fast primitive loops and conditions instead of falling back to relatively slow native JS implementations (forEach-map-reduce etc.) as Underscore does. And this gap increases for web apps being developed with aim to provide really fast and pure experience on any platform — not talking about PhoneGap-like webviewers, but about REAL seamless (homescreen) web apps. And from this point, strict Meteor dependency on Underscore has always been a fly in the ointment (another one is jQuery, though this is off-topic for sure).
@avital I switched to lodash due to lack of cloneDeep and so far haven't looked back.Everytime I need some new feature I just look at documentation and 99% find it there. Lodash is very fast, feature rich and very high quality code. Due to my lisp heritage I code in heavily functional style and use lodash extensively where other people would use for loops (Steve Apter http://nsl.com/ style) and so far lodash always delivered both stylistically and performance wise. Here's how my code usually looks like
function raze(arr, keys) {
return _.reduce(keys, function (res, key) {
return res.concat(_.map(arr, function (d) {
return {
Year: d.Year,
Name: key,
Value: d[key]
};
}));
}, []);
}
function distribute2(people, amount){
return _.reduce(_.sortBy(people,'need'),function(memo,person){
var ration = Math.min(person.demand,memo.amount);
memo.amount -= ration;
memo.people.push(_.assign(person,{ ration: ration}));
return memo;
},{ amount: amount, people: [] }).people;
}
Just give lodash a shot and I'm sure @jdalton will help you in any roadblock you hit on. Whatever bug you fixed on underscore there's a big chance its already fixed on lodash.
For me, I haven't used it as I like to stick to Meteor defaults, but I like that its feature rich, well documented and has deep cloning. :)
Cheers, // Tim
2014-11-24 21:35 GMT+01:00 slobodanblazeski notifications@github.com:
@avital https://github.com/avital I switched to lodash due to lack of cloneDeep and so far haven't looked back.Everytime I need some new feature I just look at documentation and 99% find it there. Lodash is very fast, feature rich and very high quality code. Due to my lisp heritage I code in heavily functional style and use lodash extensively where other people would use for loops (Steve Apter http://nsl.com/ style) and so far lodash always delivered both stylistically and performance wise. Here's how my code usually looks like
function raze(arr, keys) { return .reduce(keys, function (res, key) { return res.concat(.map(arr, function (d) { return { Year: d.Year, Name: key, Value: d[key] }; })); }, []); } function distribute2(people, amount){ return .reduce(.sortBy(people,'need'),function(memo,person){ var ration = Math.min(person.demand,memo.amount); memo.amount -= ration; memo.people.push(_.assign(person,{ ration: ration})); return memo; },{ amount: amount, people: [] }).people; }
Just give lodash a shot and I'm sure @jdalton https://github.com/jdalton will help you in any roadblock you hit on. Whatever bug you fixed on underscore there's a big chance its already fixed on lodash.
— Reply to this email directly or view it on GitHub https://github.com/meteor/meteor/issues/1009#issuecomment-64259518.
Cheers, // Tim Brandin @timbrandin https://twitter.com/#!/timbrandin http://timbrandin.com http://studiointeract.com
I would like to use lodash ( and will if I get time to test and make conversion ). I WAS worried about interfering with Meteor functionality but I see from earlier comments that lodash can be used without messing with Meteor.
For myself, I would be happy with an official way to use lodash in our code. I have no need to care about what Meteor uses internally - if I can independently use lodash.
_86 Upvotes_ It's been mentioned a few times, so I figured I'd track progress/questions with an issue.
_85 Upvotes_