# manip

> A library for manipulating nested data in a way reminiscent of MongoDB's "Field Update Operators" work (eg. $set)

Latest version **0.9.4** (published 2014-09-27) · 0 weekly downloads

## Install

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

## 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.9.4 |
| Published | 2014-09-27 |
| First published | 2014-02-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >0.9 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Matthew Forrester |
| Maintainers | forbesmyster |

## Links

- npm: https://www.npmjs.com/package/manip
- Repository: https://github.com/forbesmyester/manip
- Issues: https://github.com/forbesmyester/manip/issues
- npm.io page: https://npm.io/package/manip

## Recent versions

- 0.9.4 (latest) — 2014-09-27
- 0.9.3 — 2014-03-22
- 0.9.2 — 2014-02-13
- 0.9.1 — 2014-02-06
- 0.1.0 — 2014-02-06

## README

# Manip

A library for manipulating nested data in a way reminiscent of [MongoDB's "Update Operators"](http://docs.mongodb.org/manual/reference/operator/update/) work (eg. `$set`, `$unset`, `$push` and `$inc`)".

The following operations are current supported:

 * $set
 * $unset
 * $push
 * $inc

Given a set of data, sometimes you want to be able to be able to modify deeply nested data without hard coding the path to that data or worring if the sub sub subdocument you want to add to already exists.

Take the following example:

```javascript
var jack = {
	eyes: 'blue',
	car: {
		ford: {
			wheels: 4,
			age: 3,
			color: 'blue'
		}
	}
};
```

I could increase the age of the car by one year

```javascript
manip(jack, {'$inc': {'car.ford.age': 1}}));
```
and now the data is:

```javascript
{
	eyes: 'blue',
	car: {
		ford: {
			wheels: 4,
			age: 4,
			color: 'blue'
		}
	}
}
```

## Source Code

Source code is prepared using [Browserify](http://browserify.org/) which is also compatible with Node.JS. There is a UMD bundle which can be used with AMD or a vanilla browser (where it will export a global called manip.

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