# get-first

> Pass an array of object paths (e.g. `a.b.c`) and get the first non-undefined value if the property exists, or null if it does not.

Latest version **0.1.2** (published 2016-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-first
pnpm add get-first
yarn add get-first
bun add get-first
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-01-18 |
| First published | 2014-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jon Schlinkert |
| Maintainers | doowb, jonschlinkert |
| Keywords | get, key, array, nested, object, path, paths, prop, first, properties, property, props, segment, util, utilities, utility, utils, value, values |

## Links

- npm: https://www.npmjs.com/package/get-first
- Repository: https://github.com/jonschlinkert/get-first
- Issues: https://github.com/jonschlinkert/get-first/issues
- npm.io page: https://npm.io/package/get-first

## Dependencies (1)

- [get-value](https://npm.io/package/get-value.md) ^2.0.2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2016-01-18
- 0.1.1 — 2014-11-05
- 0.1.0 — 2014-11-04

## README

# get-first [![NPM version](https://img.shields.io/npm/v/get-first.svg)](https://www.npmjs.com/package/get-first)

> Pass an array of object paths (e.g. `a.b.c`) and get the first non-undefined value if the property exists, or null if it does not.

## Install
Install with [npm](https://www.npmjs.com/):

```sh
$ npm i get-first
```

## Run tests

```bash
npm test
```

## Usage

```js
var getFirst = require('get-first');

getFirst({a: 'b'}, 'a');
//=> 'b'

getFirst({a: 'b'}, ['a']);
//=> 'b'

getFirst({a: {b: 'c'}}, 'a.b');
//=> 'c'

getFirst({a: {b: 'c'}}, ['a.b']);
//=> 'c'

getFirst({a: {b: 'c'}, x: {b: 'd'}}, ['a.b', 'x.b']);
//=> 'c'

getFirst({a: {b: 'c'}, x: {b: 'd'}}, ['x.b', 'a.b']);
//=> 'd'

getFirst({a: {b: {c: 'd'}}}, ['a.b', 'x.y.z']);
//=> {c: 'd'}

getFirst({a: {b: {c: 'd'}, e: 'f'}}, ['a.c', 'a.e']);
//=> 'f'
```

## Related


## Running tests
Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/get-first/issues/new).

## Author
**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 

## License
Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.

***

_This file was generated by [verb](https://github.com/verbose/verb) on January 18, 2016._

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