hoolock
Suite of 43 lightweight utilities designed to maintain a small footprint when bundled, without compromising on ease of integration and use. Heavily inspired by lodash, I created hoolock to meet my own needs and preferences, which are primarily concerned with size.
Features
-
Tree-Shakable ✅
-
The main entry point exports all utilities as named exports; however, is designed to be tree-shakable by most modern bundlers. As of version
2.0.0
, each release has tree-shakability tested in rollup and esbuild (on minimal or default tree-shaking settings).Individual imports should not be necessary in most environments. Despite this, hoolock maintains a modular design, with a unique entry point for each of the 43 utilities.
-
Built-ins Preferred ✅
-
JavaScript's built-in functions, such as
Array.prototype.map
,Array.prototype.forEach
andObject.keys
, are prioritized to minimize size and improve performance. Utilities with built-in 'equivalents' are typically extensions. For example,join
accepts a distinct, final delimiter; however, still leveragesArray.prototype.join
internally. -
CJS & ESM Support ✅
-
Despite its compact size, hoolock contains builds for both CommonJS (CJS) and ECMAScript Modules (ESM).
-
React Compatible ✅
-
Several utilities were built with React integrations in mind. For example,
clone
,cloneDeep
andmerge
will ignore/preserve React elements. Additionally, many utilities (e.g.merge
) are immutable, following React's state management principles.