# ipath

> Ensure immutability by updating javascript objects using a path similar to CSS/jQuery selector, great for react/redux applications where immutability is required, especially when working with deeply nested objects.

Latest version **0.1.1** (published 2018-01-03) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2018-01-03 |
| First published | 2017-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nan Li |
| Maintainers | ln613 |
| Keywords | javascript, immutable, ramda |

## Links

- npm: https://www.npmjs.com/package/ipath
- Repository: https://github.com/ln613/ipath
- Homepage: https://github.com/ln613/ipath#readme
- Issues: https://github.com/ln613/ipath/issues
- npm.io page: https://npm.io/package/ipath

## Dependencies (1)

- [ramda](https://npm.io/package/ramda.md) ^0.25.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2018-01-03
- 0.1.0 — 2017-12-20

## README

# ipath

[![Build Status](https://travis-ci.org/ln613/ipath.svg?branch=master)](https://travis-ci.org/ln613/ipath)

Ensure immutability by updating javascript objects using a path similar to CSS/jQuery selector, great for react/redux applications where immutability is required, especially when working with deeply nested objects.

[documetation](https://ln613.gitbooks.io/ipath/)

## Install

`npm i -S ipath`

## Usage

```js
import { update } from 'ipath';

const obj = {
  artists: [
    {
      id: 3,
      name: 'A1',
      albums: [
        { id: 1, name: 'a1', year: 1990 },
        { id: 2, name: 'a2', year: 1995 },
      ]
    }
  ]
};

let newObj = update(obj, 'artists[id=3].albums[name=a2].year', 1992);
// obj doesn't change, newObj.artists[0].albums[1].year = 1992

let newAlbum = { id: 3, name: 'a3', year: 2000 }
newObj = update(obj, 'artists[0].albums[]', newAlbum);
// add newAlbum to the albums list

newObj = update(obj, 'artists[id=3].albums[name=a2]', null);
// delete an item from array
```

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