# find-by-key

> Find objects in deeply nested object trees.

Latest version **1.0.0** (published 2016-03-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install find-by-key
pnpm add find-by-key
yarn add find-by-key
bun add find-by-key
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-08 |
| First published | 2016-03-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | steffen.giers@gmail.com |
| Maintainers | gearsdigital |

## Links

- npm: https://www.npmjs.com/package/find-by-key
- Repository: https://github.com/gearsdigital/find-by-key
- Homepage: https://github.com/gearsdigital/find-by-key#readme
- Issues: https://github.com/gearsdigital/find-by-key/issues
- npm.io page: https://npm.io/package/find-by-key

## Recent versions

- 1.0.0 (latest) — 2016-03-08

## README

# Find by Key
> Find objects in deeply nested object trees.

## Install

```sh
$ npm install find-by-key  --save
```

## Usage

```js
var findByKey = require('find-by-key');

var tree = {
  public: {
    serviceList: [
      'pub-service-1',
      'pub-service-2'
    ]
  },
  devices: [{
    device: {
      serviceList: [
        'a-service-1',
        'a-service-2',
        'a-service-3',
        'a-service-4'
      ]
    },
  },{
    device: {
      serviceList: [
        'b-service-1',
        'b-service-2',
        'b-service-3'
      ]
    }
  }]
}

var serviceLists = findByKey(tree, 'serviceList');

// Result
[
  ["pub-service-1", "pub-service-2"],
  ["a-service-1", "a-service-2", "a-service-3", "a-service-4"],
  ["b-service-1", "b-service-2", "b-service-3"]
]
```

## Methods

```js
/**
 * findByKey
 *
 * @param {Object} nested Object to search
 * @param {String} needle Key to find
 * @return {Array}
 */
findByKey(nested, needle);

```

## Legal
Original is taken from http://stackoverflow.com/a/10948908/294076

---
_Source: https://npm.io/package/find-by-key · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
