_.defaults({Ā 'a':Ā 1Ā },Ā {Ā 'a':Ā 3,Ā 'b':Ā 2Ā });//Ā āĀ {Ā 'a':Ā 1,Ā 'b':Ā 2Ā }_.partition([1,Ā 2,Ā 3,Ā 4],Ā nĀ =>Ā nĀ %Ā 2);//Ā āĀ [[1,Ā 3],Ā [2,Ā 4]]Lodash is released under the MIT license & supports modern environments. Review the build differences & pick one thatās right for you.
In a browser:
<scriptĀ src="lodash.js"></script>Using npm:
$Ā npmĀ iĀ -gĀ npm$Ā npmĀ iĀ --saveĀ lodashIn Node.js:
//Ā LoadĀ theĀ fullĀ build.varĀ _Ā =Ā require('lodash');//Ā LoadĀ theĀ coreĀ build.varĀ _Ā =Ā require('lodash/core');//Ā LoadĀ theĀ FPĀ buildĀ forĀ immutableĀ auto-curriedĀ iteratee-firstĀ data-lastĀ methods.varĀ fpĀ =Ā require('lodash/fp');Ā //Ā LoadĀ methodĀ categories.varĀ arrayĀ =Ā require('lodash/array');varĀ objectĀ =Ā require('lodash/fp/object');Ā //Ā Cherry-pickĀ methodsĀ forĀ smallerĀ browserify/rollup/webpackĀ bundles.varĀ atĀ =Ā require('lodash/at');varĀ curryNĀ =Ā require('lodash/fp/curryN');Note:
Install n_ for Lodash use in the Node.js < 6 REPL.
Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. Lodashās modular methods are great for:
Lodash is available in a variety of builds & module formats.
Tested in Node.js 4+, Bun 1.0+, and the latest Chromium, Firefox, WebKit, and Edge via Playwright, with a best-effort commitment to support Chrome 74+, Firefox 66+, IE 11, Edge 18, and Safari 11+.