# dottie

> Fast and safe nested object access and manipulation in JavaScript

Latest version **2.0.7** (published 2026-02-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install dottie
pnpm add dottie
yarn add dottie
bun add dottie
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2026-02-24 |
| First published | 2013-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/dottie) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 255 |
| Author | Mick Hansen |
| Maintainers | mickhansen |

## Links

- npm: https://www.npmjs.com/package/dottie
- Repository: https://github.com/mickhansen/dottie.js
- Homepage: https://github.com/mickhansen/dottie.js#readme
- Issues: https://github.com/mickhansen/dottie.js/issues
- npm.io page: https://npm.io/package/dottie

## Recent versions

- 2.0.7 (latest) — 2026-02-24
- 2.0.6 — 2023-06-13
- 2.0.4 — 2023-06-08
- 2.0.3 — 2023-02-07
- 2.0.2 — 2019-12-02
- 2.0.1 — 2018-10-23
- 2.0.0 — 2017-01-02
- 1.1.1 — 2015-12-07
- 1.1.0 — 2015-11-17
- 1.0.0 — 2015-09-19
- 0.3.1 — 2015-02-25
- 0.3.0 — 2015-02-25
- 0.2.6 — 2014-12-23
- 0.2.5 — 2014-12-22
- 0.2.4 — 2014-05-13
- … 11 more at https://npm.io/package/dottie/versions

## README

[![Build Status](https://travis-ci.org/mickhansen/dottie.js.svg?branch=master)](https://travis-ci.org/mickhansen/dottie.js)

Dottie helps you easily (and without sacrificing too much performance) look up and play with nested keys in objects, without them throwing up in your face.

**Not actively maintained. You are likely better off using lodash or ES6+**

## Install
    npm install dottie

## Usage
For detailed usage, check source or tests.

### Get value
Gets nested value, or undefined if unreachable, or a default value if passed.

```js
var values = {
  some: {
    nested: {
        key: 'foobar';
    }
  },
  'some.dot.included': {
    key: 'barfoo'
  }
}

dottie.get(values, 'some.nested.key'); // returns 'foobar'
dottie.get(values, 'some.undefined.key'); // returns undefined
dottie.get(values, 'some.undefined.key', 'defaultval'); // returns 'defaultval'
dottie.get(values, ['some.dot.included', 'key']); // returns 'barfoo'
```

*Note: lodash.get() also works fine for this* 

### Set value

Sets nested value, creates nested structure if needed

```js
dottie.set(values, 'some.nested.value', someValue);
dottie.set(values, ['some.dot.included', 'value'], someValue);
dottie.set(values, 'some.nested.object', someValue, {
  force: true // force overwrite defined non-object keys into objects if needed
});
```

### Transform object
Transform object from keys with dottie notation to nested objects

```js
var values = {
  'user.name': 'Gummy Bear',
  'user.email': 'gummybear@candymountain.com',
  'user.professional.title': 'King',
  'user.professional.employer': 'Candy Mountain'
};
var transformed = dottie.transform(values);

/*
{
  user: {
    name: 'Gummy Bear',
    email: 'gummybear@candymountain.com',
    professional: {
      title: 'King',
      employer: 'Candy Mountain'
    }
  }
}
*/
```

#### With a custom delimiter

```js
var values = {
  'user_name': 'Mick Hansen',
  'user_email': 'maker@mhansen.io'
};
var transformed = dottie.transform(values, { delimiter: '_' });

/*
{
  user: {
    name: 'Mick Hansen',
    email: 'maker@mhansen.io'
  }
}
*/
```

### Get paths in object
```js
var object = {
  a: 1,
  b: {
    c: 2,
    d: { e: 3 }
  }
};

dottie.paths(object); // ["a", "b.c", "b.d.e"];
```

## Performance

`0.3.1` and up ships with `dottie.memoizePath: true` by default, if this causes any bugs, please try setting it to false

## License

[MIT](https://github.com/mickhansen/dottie.js/blob/master/LICENSE)

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