# Extension points — lodash/lodash

> Canonical page: https://codevetter.com/unpack/lodash/extension-points

# Extension points — lodash/lodash

Scanned commit 2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8 (2026-09-11). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The intended way to add a method is: implement it in `lodash.js`, attach it with `lodash.<name> = <name>` in the assignment block, add tests in `test/test.js`, and — if it should exist in FP form — register it in the right `fp/_mapping.js` tables. `fp/_mapping.js` is the real registry: arity bucket, rearg order, iteratee cap, spread config, mutation class, alias and remap are all declarative. `_baseConvert`'s `wrappers` object is the escape hatch for methods whose conversion can't be expressed in tables. At runtime, `_.mixin` and `_.runInContext` are the library's public extension APIs, and `templateSettings` is the configuration hook for `_.template`.
- The method registry is the literal assignment block near the end of `runInContext` — every public method appears as `lodash.<name> = <name>`, and omitting a line there makes an implemented function unreachable. — [lodash.js#L16900-16960](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L16900-L16960) [lodash.js#L17008](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L17008)
- `mapping.aryMethod[1|2|3|4]` is the primary FP registration point: `_baseConvert` iterates exactly these buckets to decide which methods get wrapped, and `lib/fp/build-modules.js` unions them into `aryMethods` to decide `module.jst` vs `thru.jst`. — [fp/_mapping.js#L71-120](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_mapping.js#L71-L120) [fp/_baseConvert.js#L525-532](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_baseConvert.js#L525-L532) [lib/fp/build-modules.js#L15-20](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L15-L20)
- `_baseConvert`'s `wrappers` object is a named override table — `castArray`, `iteratee`, `mixin`, `nthArg`, `rearg`, `runInContext` each get bespoke conversion logic that bypasses the table-driven pipeline. — [fp/_baseConvert.js#L199-262](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_baseConvert.js#L199-L262) [fp/_baseConvert.js#L470-475](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_baseConvert.js#L470-L475)
- `mapping.remap` lets an FP-only method name map onto a different real lodash method, and `build-modules.js` reads it both to emit extra module paths and, via `_.get(mapping.remap, name, name)`, to write the correct `require` inside the generated module. — [fp/_mapping.js#L281-316](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_mapping.js#L281-L316) [lib/fp/build-modules.js#L126-135](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L126-L135) [lib/fp/template/modules/module.jst](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/template/modules/module.jst)
- `mapping.aliasToReal` drives three things at once: alias resolution inside `wrap()`, the `alias.jst` re-export module, and the generated FP-Guide's alias listing. — [fp/_mapping.js#L1-70](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_mapping.js#L1-L70) [fp/_baseConvert.js#L469](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_baseConvert.js#L469) [lib/fp/build-modules.js#L53-55](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L53-L55) [lib/fp/template/doc/wiki.jst#L155-160](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/template/doc/wiki.jst#L155-L160)
- Opting a method out of FP transforms is declarative: add its name to `mapping.skipFixed` (no arity cap) or `mapping.skipRearg` (no argument reordering), both read inside `castFixed`/`castRearg`. — [fp/_mapping.js#L317-357](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_mapping.js#L317-L357) [fp/_baseConvert.js#L315-341](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/fp/_baseConvert.js#L315-L341)
- The `lib/fp/template/modules/*.jst` set is the emission plugin surface — `getTemplate()` dispatches to `alias`, `category`, `thru` or `module` based on `isAlias`/`isCategory`/`isThru`, so a new module shape means a new `.jst` plus a branch there. — [lib/fp/build-modules.js#L87-103](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L87-L103) [lib/fp/template/modules/category.jst](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/template/modules/category.jst) [lib/fp/template/modules/alias.jst](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/template/modules/alias.jst)
- `file.globTemplate` auto-discovers templates by glob and keys them by basename, so dropping a new `.jst` into `lib/fp/template/modules/` makes it available as `template.<basename>` without registering it anywhere. — [lib/common/file.js#L32-37](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/common/file.js#L32-L37) [lib/fp/build-modules.js#L12-13](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L12-L13)
- `_.mixin(object, source, options)` is the public plugin API: it walks `baseFunctions(source)`, assigns each onto the target, and when the target is a function also installs a chain-aware prototype method honoring `options.chain`. — [lodash.js#L15828-15862](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L15828-L15862)
- `_.runInContext(context)` is the sandboxing extension point — the `contextProps` array enumerates the 30 substitutable globals, documented with the example of swapping `setTimeout` for `setImmediate`. — [lodash.js#L297-303](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L297-L303) [lodash.js#L1440-1450](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L1440-L1450)
- `lodash.templateSettings` is the documented configuration object for `_.template`'s `escape`/`evaluate`/`interpolate` delimiters, `imports` and `variable`, read at the top of `template()`. — [lodash.js#L1764-1780](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L1764-L1780) [lodash.js#L14882-14892](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lodash.js#L14882-L14892)
- The doc pipeline is configured by the `config` object in `lib/main/build-doc.js`, keyed `base`/`github`/`site` and merged with `_.defaults`; adding a third output style means adding a key there and a matching npm script. — [lib/main/build-doc.js#L17-35](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/main/build-doc.js#L17-L35) [lib/main/build-doc.js#L76-81](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/main/build-doc.js#L76-L81)
- The Playwright project list in `playwright.config.js` is the browser-matrix registry — adding a browser or device is one entry in `projects`, and adding a page to test is one `test()` block in `test/playwright-runner.spec.js`. — [playwright.config.js#L14-30](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/playwright.config.js#L14-L30) [test/playwright-runner.spec.js#L5-24](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/test/playwright-runner.spec.js#L5-L24)
- `lib/fp/build-modules.js` hardcodes an 11-entry `categories` list and an `ignored` glob list; a new lodash category or a new private-file naming convention requires editing both arrays. — [lib/fp/build-modules.js#L22-44](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/lib/fp/build-modules.js#L22-L44)
- `test-ui.js`'s `ui.buildPath` switch is the harness registry for testable builds — the four cases (`lodash`, `lodash-dev`, `lodash-core`, `lodash-core-dev`) must be kept in sync with the `<option>` values written into the toolbar. — [test/asset/test-ui.js#L72-80](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/test/asset/test-ui.js#L72-L80) [test/asset/test-ui.js#L109-120](https://github.com/lodash/lodash/blob/2b5e6f7399a7b48005140b5d5c6bc6c0e62919a8/test/asset/test-ui.js#L109-L120)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
