Switchin to next versions, it’s very simple for an Angular 4 application to integrate (providing the types exists) and to develop with !
For Lodash, we just need to install both the lib and the types :
npm install --save lodash
npm install --save-dev @types/lodash
Just import in your component the library and use it :
import * as _ from 'lodash';var tmpHero: Hero = _.find(heroes, (hero) => hero.id == id);
Now get rid of Lodash
Speaking of performance, you might want to check that kind of test that compares native Date with Moment functions calls :Native Date Vs Moment.js · jsPerfvar timestamp = new Date(556095600000), day = timestamp.getUTCDate(), month = timestamp.getMonth() + 1, year …jsperf.com
As of Lodash, you might want to dig into the Array native methods that include powerfull stuff like the now infamous map() function that is used everyday with Observables. (sorry french link to Mozilla Dev Network … )
And you can replace most functions with native methods :
var tmpHero: Hero = _.find(heroes, (hero) => hero.id == id);// becomesvar tmpHero: Hero = heroes.find((hero) => hero.id == id);
Not all situations allow to get rid of such libraries, but I think it’s worth digging into native stuff, especially for Angular apps that already come with a nice complexity.