# @marcopeg/dotted

> Extract data from an object using a dotted notation

Latest version **1.12.0** (published 2020-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @marcopeg/dotted
pnpm add @marcopeg/dotted
yarn add @marcopeg/dotted
bun add @marcopeg/dotted
```

## 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.12.0 |
| Published | 2020-03-30 |
| First published | 2019-06-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Marco Pegoraro |
| Maintainers | marcopeg |
| Keywords | object, extract, dot, path, dotted, properties, value |

## Links

- npm: https://www.npmjs.com/package/@marcopeg/dotted
- Repository: https://github.com/marcopeg/npm-packages/tree/master/packages/dotted
- Homepage: https://github.com/marcopeg/npm-packages/tree/master/packages/dotted#readme
- Issues: https://github.com/marcopeg/npm-packages/issues
- npm.io page: https://npm.io/package/@marcopeg/dotted

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.4.4

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

- 1.12.0 (latest) — 2020-03-30
- 1.11.0 — 2020-03-30
- 1.9.0 — 2020-03-27
- 1.8.0 — 2020-03-27
- 1.7.1 — 2020-03-27
- 1.7.0 — 2020-03-27
- 1.5.0 — 2020-03-02
- 1.4.0 — 2020-02-27
- 1.3.0 — 2020-02-26
- 1.2.0 — 2019-09-10
- 0.2.9 — 2019-08-16
- 0.2.0 — 2019-06-28
- 0.1.3 — 2019-06-24
- 0.1.2 — 2019-06-24
- 0.1.1 — 2019-06-24
- … 1 more at https://npm.io/package/@marcopeg/dotted/versions

## README

# @marcopeg/dotted

Extract data from an object using a dotted notation:

```js
import dotted from '@marcopeg/dotted'

const data = {
    name: 'marco',
    surname: 'pegoraro',
    family: {
        father: { name: 'piero' },
        mother: { name: 'teresa' },
        siblings: [
            { name: 'giulia' },
            { name: 'elisa' },
        ]
    }
}

dotted(data, 'name')
// -> marco

dotted(data, 'family.father.name')
// -> piero

dotted(data, 'family.siblings.$0.name')
// -> giulia

dotted(data, 'family.siblings.$LENGTH')
// -> 2

dotted(data, 'family.siblings.$FIRST.name')
// -> giulia

dotted(data, 'family.siblings.$LAST.name')
// -> elisa
```

Set data into an object using a dotted notation:

```js
import dotted from '@marcopeg/dotted'

dotted.set({}, 'foo', 1)
// -> { foo: 1 }

// Fills missing layers
dotted.set({}, 'foo.faa.fii', 1)
// -> { foo: { faa: { fii: 1 } } }

const source = { foo: 1 }
const result = dotted.set.immutable(source, 'foo', 2)
// -> source !== result (true)
// -> result.foo === 2 (true)
```

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