# finboxio-dot-prop

> Get, set, or delete a property from a nested object using a dot path

Latest version **3.0.1** (published 2016-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install finboxio-dot-prop
pnpm add finboxio-dot-prop
yarn add finboxio-dot-prop
bun add finboxio-dot-prop
```

## 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 | 3.0.1 |
| Published | 2016-03-22 |
| First published | 2016-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sindre Sorhus |
| Maintainers | abpai |
| Keywords | obj, object, prop, property, dot, path, get, set, delete, del, access, notation, dotty |

## Links

- npm: https://www.npmjs.com/package/finboxio-dot-prop
- Repository: https://github.com/sindresorhus/dot-prop
- Homepage: https://github.com/sindresorhus/dot-prop#readme
- Issues: https://github.com/sindresorhus/dot-prop/issues
- npm.io page: https://npm.io/package/finboxio-dot-prop

## Dependencies (1)

- [is-obj](https://npm.io/package/is-obj.md) ^1.0.0

## 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

- 3.0.1 (latest) — 2016-03-22
- 3.0.0 — 2016-03-22

## README

# dot-prop [![Build Status](https://travis-ci.org/sindresorhus/dot-prop.svg?branch=master)](https://travis-ci.org/sindresorhus/dot-prop)

> Get, set, or delete a property from a nested object using a dot path
> MAIN DIFFERENCE FROM sindresorhus/dot-prop is that it will not throw errors when you do get({ a: null }, 'a.b.c')


## Install

```
$ npm install --save dot-prop
```


## Usage

```js
const dotProp = require('dot-prop');

// getter
dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar');
//=> 'unicorn'

dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep');
//=> undefined

dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot');
//=> 'unicorn'

// setter
const obj = {foo: {bar: 'a'}};
dotProp.set(obj, 'foo.bar', 'b');
console.log(obj);
//=> {foo: {bar: 'b'}}

dotProp.set(obj, 'foo.baz', 'x');
console.log(obj);
//=> {foo: {bar: 'b', baz: 'x'}}

// deleter
const obj = {foo: {bar: 'a'}};
dotProp.delete(obj, 'foo.bar');
console.log(obj);
//=> {foo: {}}

obj.foo.bar = {x: 'y', y: 'x'};
dotProp.delete(obj, 'foo.bar.x');
console.log(obj);
//=> {foo: {bar: {y: 'x'}}}
```


## API

### get(obj, path)

### set(obj, path, value)

### delete(obj, path)

#### obj

Type: `object`

Object to get, set, or delete the `path` value.

#### path

Type: `string`

Path of the property in the object. Use `.` for nested objects or `\\.` to add a `.` in a key.

#### value

Type: `any`

Value to set at `path`.


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)

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