# Wild Wild Path | Object property paths with wildcards and regexps 🌵

**URL:** <https://onehack.st/t/wild-wild-path-object-property-paths-with-wildcards-and-regexps/287887>\
**Category:** Tools & Scripts\
**Tags:** programming, freebies\
**Created:** [July 29, 2024, 9:20pm UTC](https://onehack.st/t/wild-wild-path-object-property-paths-with-wildcards-and-regexps/287887 "2024-07-29T21:20:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prometheus](https://onehack.st/user_avatar/onehack.st/prometheus/32/34950_2.png) [@Prometheus](https://onehack.st/u/Prometheus)\
**Post date:** [July 29, 2024, 9:20pm UTC](https://onehack.st/t/wild-wild-path-object-property-paths-with-wildcards-and-regexps/287887/1 "2024-07-29T21:20:37Z")

</div>

[![wild-wild-path logo](https://raw.githubusercontent.com/ehmicky/design/main/wild-wild-path/wild-wild-path.svg?sanitize=true)](https://raw.githubusercontent.com/ehmicky/design/main/wild-wild-path/wild-wild-path.svg?sanitize=true)

[![Node](https://camo.githubusercontent.com/ca547bb1280cb8296e178b5bcc3a4d439240f0c43aedd4d8bf3a4259da629e70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4e6f64652e6a732d3830383038303f6c6f676f3d6e6f64652e6a7326636f6c6f72413d343034303430266c6f676f436f6c6f723d363663633333)](https://www.npmjs.com/package/wild-wild-path) [![Browsers](https://camo.githubusercontent.com/8a31d9b68d9b604d1fece0708cff604777e64a601b1f56944e5ca4735cc834c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d42726f77736572732d3830383038303f6c6f676f3d66697265666f7826636f6c6f72413d343034303430)](https://unpkg.com/wild-wild-path?module) [![TypeScript](https://camo.githubusercontent.com/322c02cf73544b606ce151dabe438b79ea430e94059f5cdcf242155c5a2be705/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d54797065642d3830383038303f6c6f676f3d7479706573637269707426636f6c6f72413d343034303430266c6f676f436f6c6f723d303039366666)](https://github.com/ehmicky/wild-wild-path/blob/main/src/main.d.ts) [![Codecov](https://camo.githubusercontent.com/c9c25761d3d55294e182d3934a179a774f69b9553b97fff0e50db1b38020380c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d5465737465642532303130302532352d3830383038303f6c6f676f3d636f6465636f7626636f6c6f72413d343034303430)](https://codecov.io/gh/ehmicky/wild-wild-path) [![Minified size](https://camo.githubusercontent.com/d76e518a8b87138f9e60163fce30a1d2f196cd4dc20f8d48bd24977a56847e6e/68747470733a2f2f696d672e736869656c64732e696f2f62756e646c6570686f6269612f6d696e7a69702f77696c642d77696c642d706174683f6c6162656c26636f6c6f72413d34303430343026636f6c6f72423d383038303830266c6f676f3d7765627061636b)](https://bundlephobia.com/package/wild-wild-path) [![Mastodon](https://camo.githubusercontent.com/6eecb38e4e3705ba3aeaeb1fc420e2c544643299e3f5f06b192b44dd61e00963/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4d6173746f646f6e2d3830383038302e7376673f6c6f676f3d6d6173746f646f6e26636f6c6f72413d343034303430266c6f676f436f6c6f723d393539304639)](https://fosstodon.org/@ehmicky) [![Medium](https://camo.githubusercontent.com/0744f131b842961d36af70687ec318f687f24f5da435515a096da26b529ae814/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4d656469756d2d3830383038302e7376673f6c6f676f3d6d656469756d26636f6c6f72413d343034303430)](https://medium.com/@ehmicky)

🤠 Object property paths with wildcards and regexps. 🌵

Get/set object properties using:

- ⛏ [Dot-delimited paths](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-deep-properties): `foo.bar.0.baz`
- ⭐ [Wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards): `foo.*`, `**.bar`
- 🗺 [Regexps](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-regexps): `foo./ba?/`
- 🏜 [Slices](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-array-slices): `foo.0:2`
- 🚂 [Unions](https://github.com/ehmicky/wild-wild-path#-unions): `foo bar baz`

# Hire me

Please [reach out](https://www.linkedin.com/feed/update/urn:li:activity:7117265228068716545/) if you’re looking for a Node.js API or CLI engineer (11 years of experience). Most recently I have been [Netlify Build](https://github.com/netlify/build)’s and [Netlify Plugins](https://www.netlify.com/products/build/plugins/)’ technical lead for 2.5 years. I am available for full-time remote positions.

# Install

npm install wild-wild-path

This package works in both Node.js \>=18.18.0 and [browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/browserslist).

This is an ES module. It must be loaded using [an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), not `require()`. If TypeScript is used, it must be configured to [output ES modules](https://www.typescriptlang.org/docs/handbook/esm-node.html), not CommonJS.

# API

## Methods

### get(target, query, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: `any | undefined`

Return the first property matching the `query`.

const target = { settings: { colors: [‘red’, ‘blue’] } } get(target, ‘settings.colors.0’) // ‘red’ get(target, [‘settings’, ‘colors’, 0]) // ‘red’

### has(target, query, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: `boolean`

Return whether the `query` matches any property.

const target = { settings: { lastName: undefined, colors: [‘red’, ‘blue’] } } has(target, ‘settings.firstName’) // false has(target, [‘settings’, ‘firstName’]) // false has(target, ‘settings.lastName’) // true

### list(target, query, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: `any[]`

Return all properties matching the `query`, as an array.

const target = { userOne: { firstName: ‘John’, lastName: ‘Doe’, age: 72 }, userTwo: { firstName: ‘Alice’, colors: [‘red’, ‘blue’, ‘yellow’] }, } list(target, ‘userOne.firstName userTwo.colors.0’) // [‘John’, ‘red’] list(target, [[‘userOne’, ‘firstName’], [‘userTwo’, ‘colors’, 0], ]) // [‘John’, ‘red’] list(target, ‘userOne./Name/’) // [‘John’, ‘Doe’] list(target, [‘userOne’, /Name/]) // [‘John’, ‘Doe’] list(target, ‘userTwo.colors._') // [‘red’, ‘blue’, ‘yellow’] list(target, ‘userTwo.colors.0:2’) // [‘red’, ‘blue’] list(target, ‘\*\*.firstName’) // [‘John’, ‘Alice’] list(target, 'userOne._’, { entries: true }) // [// { value: ‘John’, path: [‘userOne’, ‘firstName’], missing: false }, // { value: ‘Doe’, path: [‘userOne’, ‘lastName’], missing: false }, // { value: 72, path: [‘userOne’, ‘age’], missing: false }, // ]

### iterate(target, query, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: [`Iterable<any>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#examples_using_the_iteration_protocols)

Return all properties matching the `query`, as an [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#examples_using_the_iteration_protocols). This is slower than [`list()`](https://github.com/ehmicky/wild-wild-path#listtarget-query-options) but uses less memory.

const target = { settings: { colors: [‘red’, ‘blue’] } } for (const color of iterate(target, ‘settings.colors.\*’)) { console.log(color) // ‘red’, ‘blue’ }

### set(target, query, value, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`value`: `any`  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: `Target`

Sets all properties matching the `query`. The return value is a deep clone unless the [`mutate`](https://github.com/ehmicky/wild-wild-path#mutate) option is `true`.

const target = { colors: [‘red’, ‘blue’] } set(target, ‘colors.0’, ‘yellow’) // [‘yellow’, ‘blue’] set(target, [‘colors’, 0], ‘yellow’) // [‘yellow’, ‘blue’] set(target, ‘colors.-1’, ‘yellow’) // [‘red’, ‘yellow’] set(target, ‘colors.-0’, ‘yellow’) // [‘red’, ‘blue’, ‘yellow’] set(target, ‘colors.\*’, ‘yellow’) // [‘yellow’, ‘yellow’] set({}, ‘user.0.color’, ‘red’) // { user: [{ color: ‘red’ }] } set({}, ‘user.0.color’, ‘red’, { missing: false }) // {}

### remove(target, query, options?)

`target`: [`Target`](https://github.com/ehmicky/wild-wild-path#target)  
`query`: [`Query`](https://github.com/ehmicky/wild-wild-path#queries)  
`options`: [`Options?`](https://github.com/ehmicky/wild-wild-path#options)  
_Return value_: `Target`

Delete all properties matching the `query`. The return value is a deep clone unless the [`mutate`](https://github.com/ehmicky/wild-wild-path#mutate) option is `true`.

const target = { user: { firstName: ‘John’, lastName: ‘Doe’, age: 72 } } remove(target, ‘user.lastName’) // { user: { firstName: ‘John’, age: 72 } } remove(target, ‘user./Name/’) // { user: { age: 72 } } remove(target, [‘user’, /Name/]) // { user: { age: 72 } }

## Functional utilities

[`wild-wild-utils`](https://github.com/ehmicky/wild-wild-utils) is a separate library which provides with additional, higher-level methods: [`map()`](https://github.com/ehmicky/wild-wild-utils#maptarget-query-mapfunction-options), [`merge()`](https://github.com/ehmicky/wild-wild-utils#mergetarget-query-value-options), [`push()`](https://github.com/ehmicky/wild-wild-utils#pushtarget-query-values-options), [`unshift()`](https://github.com/ehmicky/wild-wild-utils#unshifttarget-query-values-options), [`find()`](https://github.com/ehmicky/wild-wild-utils#findtarget-query-testfunction-options), [`pick()`](https://github.com/ehmicky/wild-wild-utils#picktarget-query-options), [`include()`](https://github.com/ehmicky/wild-wild-utils#includetarget-query-testfunction-options), [`exclude()`](https://github.com/ehmicky/wild-wild-utils#excludetarget-query-testfunction-options), [`flatten()`](https://github.com/ehmicky/wild-wild-utils#flattentarget-options).

## Target

The target value must be an object or an array.

## Queries

There are two equivalent formats for queries: strings and arrays.

- Query [strings](https://github.com/ehmicky/wild-wild-path#query-strings) are friendlier to CLI usage, more expressive, and easier to serialize.
- Query [arrays](https://github.com/ehmicky/wild-wild-path#query-arrays) are friendlier to programmatic usage, and faster. Also, they do not require escaping, so they should be used when the input is dynamic or user-provided to prevent injection attacks.

### Query strings

#### ⛏ Deep properties

# Deep properties of objects or arrays. # Dots are used for array indices, not brackets. # Symbol properties are always ignored. user.colors.0

#### 🚂 Unions

# Unions (“or”) of queries are space-delimited. # The string must not be empty. colors name age

#### ⭐ Wildcards

# Shallow wildcards target all properties/items of a single object/array user.\* # Deep wildcards target all properties/items of 0, 1 or many objects/arrays user.\*\* \*\*.colors

#### 🗺 Regexps

# Regexps match property names user./name/ # Flags can be used, e.g. to make it case-insensitive user./name/i # ^ $ must be used to match from the beginning or until the end user./^name$/i

#### 🌵 Arrays indices

# Array indices are integers user.colors.0 # Array indices can be negative. # -1 is the last item. # -0 is the item after it, which can be used to append. user.colors.-1

#### 🏜 Array slices

# Array slices. Goes from the start (included) to the end index (excluded). user.colors.0:2 # The start index defaults to 0, i.e. the beginning user.colors.:2 # The end index defaults to -0, i.e. the end user.colors.0: user.colors.:

#### 🪨 Escaping

# Dots, spaces and backslashes in property names must be escaped name\ with\ spaces name\.with\.dots name\\with\\backslashes # Ambiguous property names must be escaped with a backslash at the beginning. # This includes properties that: # - Are integers but are not array elements # - Have multiple slashes and start with one name.\0 name.\/not\_a\_regexp/

#### 🏨 Root and empty strings

# A leading dot can optionally be used. It is ignored. user.colors .user.colors # Root value . # Empty string properties user..colors

### Query arrays

#### ⛏ Deep properties

// Deep properties of objects or arrays. // Symbol properties are always ignored. [‘user’, ‘colors’, 0]

#### 🚂 Unions

// Unions (“or”) of queries are arrays of arrays. // There must be at least one item. [[‘colors’], [‘name’], [‘age’]]

#### ⭐ Wildcards

// Shallow wildcards target all properties/items of a single object/array [‘user’, { type: ‘any’ }] // Deep wildcards target all properties/items of 0, 1 or many objects/arrays [‘user’, { type: ‘anyDeep’ }] [{ type: ‘anyDeep’ }, ‘colors’]

#### 🤠 Regexps

// Regexps match property names [‘user’, /name/] // Flags can be used, e.g. to make it case-insensitive [‘user’, /name/i] // ^ $ must be used to match from the beginning or until the end [‘user’, /^name$/i]

#### 🌵 Arrays indices

// Array indices are integers, not strings [‘user’, ‘colors’, 0] // Array indices can be negative. // -1 is the last item. // -0 is the item after it, which can be used to append. [‘user’, ‘colors’, -1]

#### 🏜 Array slices

// Array slices. Goes from the start (included) to the end index (excluded). [‘user’, ‘colors’, { type: ‘slice’, from: 0, to: 2 }] // The start index defaults to 0, i.e. the beginning [‘user’, ‘colors’, { type: ‘slice’, to: 2 }] // The end index defaults to -0, i.e. the end [‘user’, ‘colors’, { type: ‘slice’, from: 0 }] [‘user’, ‘colors’, { type: ‘slice’ }]

#### 🪨 Escaping

// Escaping is not necessary with query arrays [‘name with spaces’] [‘name.with.dots’] [‘name\with\backslashes’] [‘name’, ‘0’] [‘name’, ‘/not\_a\_regexp/’]

#### 🏨 Root and empty strings

// Root value // Empty string properties [‘user’, ‘’, ‘colors’]

### Paths

A “path” is any [query](https://github.com/ehmicky/wild-wild-path#queries) using only [property names](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-deep-properties) and positive [array indices](https://github.com/ehmicky/wild-wild-path#-arrays-indices). This excludes [negative indices](https://github.com/ehmicky/wild-wild-path#-arrays-indices), [slices](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-array-slices), [wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards), [regexps](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-regexps) and [unions](https://github.com/ehmicky/wild-wild-path#-unions).

Paths are returned by the [`entries`](https://github.com/ehmicky/wild-wild-path#entries) option.

# Path string user.colors.0

// Path array [‘user’, ‘colors’, 0]

### Conversions and comparisons

[`wild-wild-parser`](https://github.com/ehmicky/wild-wild-parser) can be used to convert between both formats, or to compare queries.

### Undefined values

Object properties with a defined key but an `undefined` value are not ignored. However, object properties without any defined key are ignored. The [`has()`](https://github.com/ehmicky/wild-wild-path#hastarget-query-options) method, [`missing`](https://github.com/ehmicky/wild-wild-path#missing) option and [`entries`](https://github.com/ehmicky/wild-wild-path#entries) option can be used to distinguish those.

const target = { name: undefined } has(target, ‘name’) // true has(target, ‘colors’) // false get(target, ‘name’) // undefined get(target, ‘colors’) // undefined get(target, ‘name’, { entries: true, missing: true }) // { value: undefined, path: [‘name’], missing: false } get(target, ‘colors’, { entries: true, missing: true }) // { value: undefined, path: [‘colors’], missing: true } list(target, ‘_') // [undefined] list(target, '_’, { entries: true }) // [{ value: undefined, path: [‘name’], missing: false }]

## Options

Options are optional plain objects.

### mutate

_Methods_: [`set()`](https://github.com/ehmicky/wild-wild-path#settarget-query-value-options), [`remove()`](https://github.com/ehmicky/wild-wild-path#removetarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

By default, the [target](https://github.com/ehmicky/wild-wild-path#target) is deeply cloned.  
When `true`, it is directly mutated instead, which is faster but has side effects.

const target = {} console.log(set(target, ‘name’, ‘Alice’)) // { name: ‘Alice’ } console.log(target) // {} console.log(set(target, ‘name’, ‘Alice’, { mutate: true })) // { name: ‘Alice’ } console.log(target) // { name: ‘Alice’ }

### entries

_Methods_: [`get()`](https://github.com/ehmicky/wild-wild-path#gettarget-query-options), [`list()`](https://github.com/ehmicky/wild-wild-path#listtarget-query-options), [`iterate()`](https://github.com/ehmicky/wild-wild-path#iteratetarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

By default, properties’ values are returned.  
When `true`, objects with the following shape are returned instead:

- `value` `any`: property’s value
- `path` [`Path`](https://github.com/ehmicky/wild-wild-path#paths): property’s full path
- `missing` `boolean`: whether the property is [missing](https://github.com/ehmicky/wild-wild-path#missing) from the [target](https://github.com/ehmicky/wild-wild-path#target)

const target = { firstName: ‘Alice’, lastName: ‘Smith’ } list(target, ‘_') // [‘Alice’, ‘Smith’] list(target, '_’, { entries: true }) // [// { value: ‘Alice’, path: [‘firstName’], missing: false }, // { value: ‘Smith’, path: [‘lastName’], missing: false }, // ]

### missing

_Methods_: all except [`has()`](https://github.com/ehmicky/wild-wild-path#hastarget-query-options) and [`remove()`](https://github.com/ehmicky/wild-wild-path#removetarget-query-options)  
_Type_: `boolean`  
_Default_: `false` with `list|iterate()`, `true` with `set()`

When `false`, properties [not defined in the target](https://github.com/ehmicky/wild-wild-path#undefined-values) are ignored.

const target = {} set(target, ‘name’, ‘Alice’) // { name: ‘Alice’ } set(target, ‘name’, ‘Alice’, { missing: false }) // {} list(target, ‘name’) // list(target, ‘name’, { missing: true, entries: true }) // [{ value: undefined, path: [‘name’], missing: true }]

### sort

_Methods_: [`get()`](https://github.com/ehmicky/wild-wild-path#gettarget-query-options), [`list()`](https://github.com/ehmicky/wild-wild-path#listtarget-query-options), [`iterate()`](https://github.com/ehmicky/wild-wild-path#iteratetarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

When returning sibling object properties, sort them by the lexigographic order of their names (not values).

const target = { lastName: ‘Doe’, firstName: ‘John’ } list(target, ‘_') // [‘Doe’, ‘John’] list(target, '_’, { sort: true }) // [‘John’, ‘Doe’]

### childFirst

_Methods_: [`get()`](https://github.com/ehmicky/wild-wild-path#gettarget-query-options), [`list()`](https://github.com/ehmicky/wild-wild-path#listtarget-query-options), [`iterate()`](https://github.com/ehmicky/wild-wild-path#iteratetarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

When using [unions](https://github.com/ehmicky/wild-wild-path#-unions) or [deep wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards), a query might match both a property and some of its children.

This option decides whether the returned properties should be sorted from children to parents, or the reverse.

const target = { user: { name: ‘Alice’ } } list(target, ‘user.**') // [{ name: ‘Alice’ }, ‘Alice’] list(target, 'user.**’, { childFirst: true }) // [‘Alice’, { name: ‘Alice’ }]

### leaves

_Methods_: all except [`has()`](https://github.com/ehmicky/wild-wild-path#hastarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

When using [unions](https://github.com/ehmicky/wild-wild-path#-unions) or [deep wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards), a query might match both a property and some of its children.

When `true`, only leaves are matched. In other words, a matching property is ignored if one of its children also matches.

const target = { user: { name: ‘Alice’ } } list(target, ‘user.**') // [{ name: ‘Alice’ }, ‘Alice’] list(target, 'user.**’, { leaves: true }) // [‘Alice’]

### roots

_Methods_: [`get()`](https://github.com/ehmicky/wild-wild-path#gettarget-query-options), [`list()`](https://github.com/ehmicky/wild-wild-path#listtarget-query-options), [`iterate()`](https://github.com/ehmicky/wild-wild-path#iteratetarget-query-options)  
_Type_: `boolean`  
_Default_: `false`

When using [unions](https://github.com/ehmicky/wild-wild-path#-unions) or [deep wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards), a query might match both a property and some of its children.

When `true`, only roots are matched. In other words, a matching property is ignored if one of its parents also matches.

const target = { user: { name: ‘Alice’ } } list(target, ‘user.**') // [{ name: ‘Alice’ }, ‘Alice’] list(target, 'user.**’, { roots: true }) // [{ name: ‘Alice’ }]

### shallowArrays

_Methods_: all  
_Type_: `boolean`  
_Default_: `false`

If `true`, [wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards) do not recurse on arrays. Array items can still be matched by using [indices](https://github.com/ehmicky/wild-wild-path#-arrays-indices) or [slices](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-array-slices).

const target = [{ name: ‘Alice’ }, { name: ‘Bob’ }] list(target, ‘**') // [// [{ name: ‘Alice’ }, { name: ‘Bob’ }], // { name: ‘Alice’ }, // ‘Alice’, // { name: ‘Bob’ }, // ‘Bob’, // ] list(target, '**’, { shallowArrays: true }) // [// [{ name: ‘Alice’ }, { name: ‘Bob’ }], // ]

### classes

_Methods_: all  
_Type_: `boolean`  
_Default_: `false`

Unless `true`, [wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards) and [regexps](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-regexps) ignore properties of objects that are not plain objects (like class instances, errors or functions). Those can still be matched by using their [property name](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-deep-properties).

const target = { user: new User({ name: ‘Alice’ }) } list(target, ‘user._') // [] list(target, 'user._’, { classes: true }) // [‘Alice’]

### inherited

_Methods_: all  
_Type_: `boolean`  
_Default_: `false`

By default, [wildcards](https://github.com/ehmicky/wild-wild-path#-wildcards) and [regexps](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-regexps) ignore properties that are either [inherited](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) or [not enumerable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties). Those can still be matched by using their [property name](https://github.com/ehmicky/wild-wild-path#%EF%B8%8F-deep-properties).

When `true`, inherited properties are not ignored, but not enumerable ones still are.

# Related projects

- [`wild-wild-utils`](https://github.com/ehmicky/wild-wild-utils): functional utilities using `wild-wild-path`’s object property paths
- [`wild-wild-parser`](https://github.com/ehmicky/wild-wild-parser): parser for `wild-wild-path`’s object property paths

## GitHub:

[https://github.com/ehmicky/wild-wild-path](https://github.com/ehmicky/wild-wild-path)
