# replace-path

> Replaces nested values in an object.

Latest version **0.1.1** (published 2016-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install replace-path
pnpm add replace-path
yarn add replace-path
bun add replace-path
```

## 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.1 |
| Published | 2016-09-22 |
| First published | 2016-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Simone Lusenti |
| Maintainers | plasticpanda |

## Links

- npm: https://www.npmjs.com/package/replace-path
- npm.io page: https://npm.io/package/replace-path

## Dependencies (1)

- [clone](https://npm.io/package/clone.md) ^1.0.2

## Recent versions

- 0.1.1 (latest) — 2016-09-22
- 0.0.1 — 2016-09-22

## README

# replace-path

Replaces nested values in an object.

[![](https://img.shields.io/travis/lusentis/replace-path.svg?maxAge=3600)]()

[![](https://nodei.co/npm/replace-path.png?compact=true)]()

#### Examples:

```js
var source = {
  a: '123',
  b: {
    m: '456',
    n: '789'
  },
  d: [{
    x: 'aaa',
    y: 'z'
  }, {
    x: 'bbb',
    y: 'w'
  }]
};
var next1 = replacePath(source, 'a', 'BAR');
var next2 = replacePath(source, 'b.n', 'BAR');
var next3 = replacePath(source, 'd..x', 'BAR');
var next4 = replacePath(source, 'd.1.x', 'BAR');
var next5 = replacePath(source, 'd..x', (source, key, oldValue) => {
  source[key + 'Bar'] = oldValue.toUpperCase();
});
```

Check [index.spec.js](index.spec.js) for detailed usage.

#### License

See `LICENSE.md`

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