Skip to content

Commit

Permalink
Merge pull request #8 from zeke/master
Browse files Browse the repository at this point in the history
Housecleaning
  • Loading branch information
yeikos committed Jul 5, 2014
2 parents fa93cf4 + e75a636 commit b071d83
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 65 deletions.
84 changes: 41 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
JavaScript/NodeJS Merge v1.1.3
==================================================
# Merge

What is it?
--------------------------------------
Merge multiple objects into one, optionally creating a new cloned object.
Similar to the jQuery.extend but more flexible. Works in Node.js and the
browser.

JavaScript/NodeJS Merge is a tool to merge multiple objects into one object, with the possibility of create a new object cloned. His operation is very similar to the [jQuery.extend](http://api.jquery.com/jQuery.extend/) function but more flexible.
## Node.js Usage

Example from NodeJS
--------------
```sh
npm install merge --save
```

var merge = require('merge'), // npm install -g merge
original, cloned;

console.log(
merge({ one: 'hello' }, { two: 'world' })
```js
var merge = require('merge'), original, cloned;

); // {"one": "hello", "two": "world"}

original = { x: { y: 1 } };
console.log(merge({one:'hello'}, {two: 'world'}));
// -> {"one": "hello", "two": "world"}

cloned = merge(true, original);
original = { x: { y: 1 } };
cloned = merge(true, original);
cloned.x.y++;

console.log(original.x.y, cloned.x.y);
// -> 1, 2
```

## Browser Usage

```html
<script src="http://files.yeikos.com/merge.js"></script>
<script>
var original, cloned;
console.log(merge({one:'hello'}, {two: 'world'}));
// -> {"one": "hello", "two": "world"}
original = { x: { y: 1 } };
cloned = merge(true, original);
cloned.x.y++;
console.log(original.x.y, cloned.x.y); // 1, 2

Example from JavaScript browser
--------------------------

<script src="http://files.yeikos.com/merge.js"></script>

<script>
var original, cloned;
console.log(
merge({ one: 'hello' }, { two: 'world' })

); // {"one": "hello", "two": "world"}
original = { x: { y: 1 } };

cloned = merge(true, original);

cloned.x.y++;

console.log(original.x.y, cloned.x.y); // 1, 2

</script>
console.log(original.x.y, cloned.x.y);
// -> 1, 2
</script>
```

## Tests

```sh
npm test
```
43 changes: 21 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{

"name": "merge",
"version": "1.1.3",
"author": "yeikos (http://www.yeikos.com)",
"description": "JavaScript/NodeJS Merge is a tool to merge multiple objects into one object, with the possibility of create a new object cloned. His operation is very similar to the jQuery.extend function but more flexible.",
"main": "merge.js",
"license": "MIT",
"homepage": "https://github.com/yeikos/js.merge",

"repository": {
"type": "git",
"url": "https://github.com/yeikos/js.merge.git"
},

"keywords": [
"merge",
"extend",
"clone",
"object",
"browser"
]

"name": "merge",
"version": "1.1.3",
"author": "yeikos (http://www.yeikos.com)",
"description": "Merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.",
"main": "merge.js",
"license": "MIT",
"homepage": "https://github.com/yeikos/js.merge",
"repository": {
"type": "git",
"url": "https://github.com/yeikos/js.merge.git"
},
"keywords": [
"merge",
"extend",
"clone",
"object",
"browser"
],
"scripts": {
"test": "cd tests; node index.js"
}
}

0 comments on commit b071d83

Please sign in to comment.