Underscore.js supplies common functional utilities for arrays, objects, and functions in browser or Node projects. It avoids modifying built-in JavaScript types.
Overview
Underscore targets everyday data manipulation in front-end and server-side JavaScript. It exposes more than a hundred helpers for iterating collections, transforming lists, grouping values, and working with functions such as binding, debouncing, and memoization.
Collection routines cover each, map, reduce, filter, and related aliases, operating on arrays, plain objects, and array-like values. Additional modules handle array diffs, object picking, deep equality checks, templating, and chaining wrappers for fluent call styles.
Distribution options include monolithic ESM or UMD bundles, minified CDN builds, and modular per-function imports for trimmed custom builds. Package managers such as npm, Meteor, and Bower are documented, along with AMD and CommonJS examples.
The maintainers test against major browsers, Node LTS releases, and Adobe ExtendScript, with stated backward compatibility goals for older ES3 engines in the 1.x line.
Key features
- Collection iteration without native extensions
- Map, reduce, filter, and grouping helpers
- Array and object utility functions
- Function bind, throttle, and debounce tools
- String template and escape helpers
- Optional OOP chaining wrapper
- Monolithic or modular import paths
- npm, CDN, and UMD distributions
Use cases
- Transforming lists in legacy browser code
- Shared helpers between Node and browser bundles
- Building smaller custom Underscore builds
- Functional-style data passes in templates
- Quick object key and value manipulation