v5.3.9 �� 21 methods �� 14KB gzip

Traverse Deeply
Into Any Data

eachDeep, filterDeep, findDeep, pickDeep, omitDeep, keysDeep — recursively navigate, query, and transform nested objects with an intuitive Lodash-style API.

▶ Live traversal · eachDeep? Playing
Path: 0/0
0
???
0
???
0
???????

Why Deepdash?

Extends Lodash with powerful deep-tree operations. Use it as a mixin or standalone.

????

eachDeep visits every node with parent stack, depth tracking, circular reference detection, and leaves-only mode.

Query & Filter

filterDeep, findDeep, someDeep �� search nested structures with predicates. Match by value, pattern, or regex.

Pick & Omit Deeply

pickDeep and omitDeep select or exclude nested fields by name, regex, or pattern. Perfect for sanitizing API responses.

Path Utilities

paths, index, keysDeep, pathToString �� introspect the full topology of your data. Build path indexes effortlessly.

Array Handling

condenseDeep cleans sparse arrays recursively. exists distinguishes real undefined from array holes �� safer than has.

Flexible Modes

Works as a Lodash mixin or standalone. ESM, CJS, browser bundle, and TypeScript types �� everything included.

All Methods

21 methods organized by category. Full TypeScript definitions included.

One Command to Start

npm, Browser, or CDN �� pick your setup.

npm install deepdash lodash
const _ = require('lodash');
require('deepdash')(_);
_.eachDeep(data, fn);
<script src="lodash.min.js"></script>
<script src="deepdash/browser/deepdash.min.js"></script>
<script> deepdash(_); </script>
<script src="https://cdn.jsdelivr.net/npm/deepdash/browser/deepdash.standalone.min.js"></script>
<script> const _ = deepdash; </script>

Try It in 10 Seconds

Install deepdash, attach it to Lodash, and start traversing nested data.

1

Install

Add deepdash and lodash to your project.

npm install deepdash lodash
2

Attach

Attach deepdash as a Lodash mixin.

const _ = require('lodash');
require('deepdash')(_);
3

Traverse

Call eachDeep on any nested data.

_.eachDeep(data, (val, key, parent, ctx) => {
  console.log(ctx.path, val);
});

Real-World Example

Your Code
const config = {
  server: { host: 'api.x.com', port: 443 },
  features: { darkMode: true, beta: false },
  logging: { level: 'info' }
};

const paths = [];
_.eachDeep(config, (v, k, p, ctx) => {
  if (!_.isObject(v) || _.isArray(v)) {
    paths.push(ctx.path + ' = ' + JSON.stringify(v));
  }
});
console.log(paths.join('\n'));
Output
server.host = "api.x.com"
server.port = 443
features.darkMode = true
features.beta = false
logging.level = "info"

????????

?????????????? 21 ????????????

准备开始构建?

探索全部 21 个 Deepdash 方法,让数据遍历变得简单优雅

在线演示 → 查看文档 GitHub