Lodash utility library exported as ES6 modules for modern JavaScript applications with tree-shaking support.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Lodash ES is the Lodash utility library exported as ES6 modules, providing 300+ utility functions for common programming tasks. It offers modular imports for better tree-shaking, enabling modern JavaScript applications to import only the specific utilities they need, reducing bundle size while maintaining the full power and consistency of the Lodash API.
npm install lodash-esimport { map, filter, reduce, cloneDeep } from "lodash-es";You can also import individual functions:
import map from "lodash-es/map.js";
import filter from "lodash-es/filter.js";For category imports:
import * as array from "lodash-es/array.js";
import * as collection from "lodash-es/collection.js";For the complete lodash instance (not recommended for production due to bundle size):
import _ from "lodash-es";import { map, filter, groupBy, cloneDeep } from "lodash-es";
const users = [
{ name: "Alice", age: 25, active: true, department: "engineering" },
{ name: "Bob", age: 30, active: false, department: "sales" },
{ name: "Charlie", age: 35, active: true, department: "engineering" }
];
// Transform data
const activeUserNames = map(
filter(users, "active"),
"name"
); // ["Alice", "Charlie"]
// Group data
const usersByDepartment = groupBy(users, "department");
/* {
engineering: [Alice, Charlie],
sales: [Bob]
} */
// Deep clone objects
const usersCopy = cloneDeep(users);Lodash ES is organized around several key concepts:
Comprehensive array utilities for creation, modification, and analysis including chunking, flattening, set operations, and element manipulation.
function chunk(array, size);
function compact(array);
function difference(array, ...values);
function drop(array, n);
function flatten(array);
function uniq(array);Iteration and transformation utilities that work with arrays, objects, and other collections, including mapping, filtering, reducing, and grouping operations.
function map(collection, iteratee);
function filter(collection, predicate);
function reduce(collection, iteratee, accumulator);
function groupBy(collection, iteratee);
function every(collection, predicate);
function some(collection, predicate);Object manipulation functions for property access, modification, merging, and transformation including deep operations and property path handling.
function get(object, path, defaultValue);
function set(object, path, value);
function merge(object, ...sources);
function pick(object, ...paths);
function omit(object, ...paths);
function keys(object);String manipulation utilities for case conversion, trimming, templating, and text processing operations.
function camelCase(string);
function kebabCase(string);
function snakeCase(string);
function capitalize(string);
function trim(string, chars);
function template(string, options);Function composition, decoration, and control flow utilities including debouncing, throttling, currying, and memoization.
function debounce(func, wait, options);
function throttle(func, wait, options);
function curry(func, arity);
function memoize(func, resolver);
function bind(func, thisArg, ...partials);
function once(func);Comprehensive type checking utilities for validating data types, including primitives, objects, arrays, and special types.
function isArray(value);
function isObject(value);
function isString(value);
function isNumber(value);
function isFunction(value);
function isEmpty(value);Mathematical utilities for arithmetic operations, rounding, and statistical calculations.
function add(augend, addend);
function subtract(minuend, subtrahend);
function multiply(multiplier, multiplicand);
function divide(dividend, divisor);
function sum(array);
function mean(array);Number manipulation utilities for clamping, range checking, and random number generation.
function clamp(number, lower, upper);
function inRange(number, start, end);
function random(lower, upper, floating);General utility functions for common programming patterns including identity, constant functions, flow control, and stub functions.
function identity(value);
function constant(value);
function noop();
function flow(...funcs);
function times(n, iteratee);
function uniqueId(prefix);Chain operations that enable method chaining and lazy evaluation for complex data transformation pipelines.
function chain(value);Date and time utilities for timestamp operations.
function now();Many lodash functions accept iteratee shorthand:
// Function iteratee
map(users, user => user.name);
// Property string shorthand
map(users, 'name');
// Object match shorthand
filter(users, { active: true });
// Property-value pair shorthand
filter(users, ['active', true]);import _ from "lodash-es";
const result = _(users)
.filter('active')
.map('name')
.sort()
.value();undefinedfalse for invalid typesNaN for invalid inputsimport { map } from "lodash-es"import map from "lodash-es/map.js"