# get-object-property

> Safely get javascript object property with fallback value and error reporting

Latest version **1.0.3** (published 2017-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-object-property
pnpm add get-object-property
yarn add get-object-property
bun add get-object-property
```

## 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.3 |
| Published | 2017-12-07 |
| First published | 2017-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vadim Kotov |
| Maintainers | vadirn |

## Links

- npm: https://www.npmjs.com/package/get-object-property
- Repository: https://github.com/vadirn/get-object-property
- Homepage: https://github.com/vadirn/get-object-property#readme
- Issues: https://github.com/vadirn/get-object-property/issues
- npm.io page: https://npm.io/package/get-object-property

## Recent versions

- 1.0.3 (latest) — 2017-12-07
- 1.0.2 — 2017-02-24
- 1.0.1 — 2017-02-16
- 1.0.0 — 2017-01-31
- 0.1.1 — 2017-01-12
- 0.1.0 — 2017-01-12

## README

# get-object-property
Safely get javascript object property with fallback value and error reporting

## API
`get-object-property` exposes only one function:
```
  getObjectProperty(executor, fallbackValue, logFunction);
```

## Examples

```javascript
  import getObjectProperty from 'get-object-property';

  const foo = {};

  const result = getObjectProperty(() => foo.bar.foo, 'default');

  // expect 'default'
  console.log(result);
```

In order to log failures in executor pass log function as a third argument:

```javascript
  import getObjectProperty from 'get-object-property';

  logFn = (err) => { console.log(err); };

  const foo = {};

  const result = getObjectProperty(() => foo.bar.foo, 'default', logFn);
  // expect to see error in console
```

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