🛠️
Utility8M+/wkMIT

underscore

Underscore is a JavaScript utility library that provides functional programming helpers for working with arrays, objects, and functions without extending built-

Installation

npm
npm install underscore
yarn
yarn add underscore
pnpm
pnpm add underscore

Import

ESM
import _ from 'underscore';

Quick Example

usage
import _ from 'underscore';

const evens = _.filter([1, 2, 3, 4, 5], (n) => n % 2 === 0);
const grouped = _.groupBy(['one', 'two', 'three'], 'length');
const throttled = _.throttle(handleScroll, 100);

About underscore

Underscore is a JavaScript utility library that provides functional programming helpers for working with arrays, objects, and functions without extending built-in JavaScript prototypes. Created by Jeremy Ashkenas in 2009, Underscore was one of the first JavaScript utility libraries and established many patterns that later became part of the JavaScript language itself. The library provides over 100 functions including each, map, reduce, filter, find, pluck, sortBy, groupBy, and countBy for collection processing, extend, defaults, pick, omit, and pairs for object manipulation, bind, partial, memoize, delay, throttle, and debounce for function handling, and template for simple string interpolation. Underscore introduced the concept of chaining utility operations with _.chain() and influenced the design of both Lodash and native JavaScript additions like Array.prototype.find and Object.entries. While Lodash has largely superseded Underscore with better performance and more features, Underscore remains in use in legacy codebases and as a dependency of Backbone.js applications. The library's clean, well-documented source code has served as an educational resource for JavaScript developers.

Quick Facts

Packageunderscore
CategoryUtility
Weekly Downloads8M+
LicenseMIT
Installnpm install underscore

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.