API Reference

Lodash

Modern utility library delivering modularity, performance, and extras for arrays, objects, strings, and functions.

Official Documentation ↗
CompatibilityThis documentation covers version v4.17. Check the official docs for the latest API surface.

Installation

npmnpm install lodash
pnpmpnpm add lodash
yarnyarn add lodash

Methods

Lodash is a utility library that provides helper functions for common programming tasks including array manipulation, object merging, string formatting, and function debouncing. It is widely used for reducing boilerplate in data transformation logic.

Key Features

  • 200+ utilities: Array, object, string, function, and collection operations
  • Consistent API: Uniform iteratee shorthand support across all functions
  • Performance: Optimized implementations for common operations
  • Modular: Import individual functions to reduce bundle size
  • Chainable: _.chain() for lazy evaluation of multiple operations
  • TypeScript: @types/lodash provides comprehensive type definitions

Errors

The following points are quoted verbatim from the official documentation. 来源:https://lodash.com/docs · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:43.126Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

  • Many lodash methods are guarded to work as iteratees for methods like _.every , _.filter , _.map , _.mapValues , _.reject , and _.some . (https://lodash.com/docs)
  • An empty object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps. (https://lodash.com/docs)
  • Note: This method supports comparing arrays, array buffers, booleans, date objects, error objects, maps, numbers, Object objects, regexes, sets, strings, symbols, and typed arrays. (https://lodash.com/docs)

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://lodash.com/docs · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:43.126Z.

  • To escape additional characters use a third-party library like he . (https://lodash.com/docs)
  • Though the “>” character is escaped for symmetry, characters like “>” and “/” don’t need escaping in HTML and have no special meaning unless they’re part of a tag or unquoted attribute value. (https://lodash.com/docs)
  • When working with HTML you should always quote attribute values to reduce XSS vectors. (https://lodash.com/docs)

FAQ

Should I use Lodash or native JavaScript methods?
Use native methods (map, filter, reduce) for simple array operations. Use Lodash for complex utilities like debounce, throttle, deep merge, groupBy, and chunk that lack native equivalents or have inconsistent browser support.
How do I reduce Lodash bundle size?
Install lodash-es for ES modules with tree-shaking, or import individual functions: import debounce from 'lodash/debounce'. Avoid importing the entire library with import _ from 'lodash'.
Is Lodash still maintained in 2024?
Lodash is in maintenance mode. It receives security patches but no new features. For new projects, consider native methods, Radash, or Remeda as modern alternatives with better TypeScript support.