Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
adding some docs, in progress still.
  • Loading branch information
selfcontained committed May 6, 2013
1 parent 3f5e183 commit 0f285a3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,40 @@ deap
====

extend and merge objects, deep or shallow, in javascript


### installation

```bash
npm install deap
```

```javascript
var deap = require('deap');
```

---

### deap() and deap.extend()

Deep extend. Copy all the properties from one object onto another, cloning objects deeply.

Takes *n* number of arguments, modifies the first argument and returns it.

```javascript
var a = { name: 'Joe' };

deap.extend(a, { age: 26 }); // returns: a => { name: 'Joe', age: 26 }
deap.extend({}, someObj); // clone someObj
```

### deap.merge()

Deep merge. Fill an object's existing properties from another object.

Takes *n* number of arguments, modifies the first argument and returns it.

```javascript
var a = { name: 'Joe', phone: '' };
deap.merge(a, { age: 26, phone: '555-555-5555' }); // returns: a => { name: 'Joe', phone: '555-555-5555' }
```

0 comments on commit 0f285a3

Please sign in to comment.