Skip to content

Commit b071d83

Browse files
committed
Merge pull request #8 from zeke/master
Housecleaning
2 parents fa93cf4 + e75a636 commit b071d83

File tree

2 files changed

+62
-65
lines changed

2 files changed

+62
-65
lines changed

README.md

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,50 @@
1-
JavaScript/NodeJS Merge v1.1.3
2-
==================================================
1+
# Merge
32

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

7-
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.
7+
## Node.js Usage
88

9-
Example from NodeJS
10-
--------------
9+
```sh
10+
npm install merge --save
11+
```
1112

12-
var merge = require('merge'), // npm install -g merge
13-
original, cloned;
14-
15-
console.log(
16-
17-
merge({ one: 'hello' }, { two: 'world' })
13+
```js
14+
var merge = require('merge'), original, cloned;
1815

19-
); // {"one": "hello", "two": "world"}
20-
21-
original = { x: { y: 1 } };
16+
console.log(merge({one:'hello'}, {two: 'world'}));
17+
// -> {"one": "hello", "two": "world"}
2218

23-
cloned = merge(true, original);
19+
original = { x: { y: 1 } };
20+
cloned = merge(true, original);
21+
cloned.x.y++;
22+
23+
console.log(original.x.y, cloned.x.y);
24+
// -> 1, 2
25+
```
26+
27+
## Browser Usage
28+
29+
```html
30+
<script src="http://files.yeikos.com/merge.js"></script>
31+
<script>
32+
var original, cloned;
2433
34+
console.log(merge({one:'hello'}, {two: 'world'}));
35+
// -> {"one": "hello", "two": "world"}
36+
37+
original = { x: { y: 1 } };
38+
cloned = merge(true, original);
2539
cloned.x.y++;
2640
27-
console.log(original.x.y, cloned.x.y); // 1, 2
28-
29-
Example from JavaScript browser
30-
--------------------------
31-
32-
<script src="http://files.yeikos.com/merge.js"></script>
33-
34-
<script>
35-
36-
var original, cloned;
37-
38-
console.log(
39-
40-
merge({ one: 'hello' }, { two: 'world' })
41-
42-
); // {"one": "hello", "two": "world"}
43-
44-
original = { x: { y: 1 } };
45-
46-
cloned = merge(true, original);
47-
48-
cloned.x.y++;
49-
50-
console.log(original.x.y, cloned.x.y); // 1, 2
51-
52-
</script>
41+
console.log(original.x.y, cloned.x.y);
42+
// -> 1, 2
43+
</script>
44+
```
45+
46+
## Tests
47+
48+
```sh
49+
npm test
50+
```

package.json

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{
2-
3-
"name": "merge",
4-
"version": "1.1.3",
5-
"author": "yeikos (http://www.yeikos.com)",
6-
"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.",
7-
"main": "merge.js",
8-
"license": "MIT",
9-
"homepage": "https://github.com/yeikos/js.merge",
10-
11-
"repository": {
12-
"type": "git",
13-
"url": "https://github.com/yeikos/js.merge.git"
14-
},
15-
16-
"keywords": [
17-
"merge",
18-
"extend",
19-
"clone",
20-
"object",
21-
"browser"
22-
]
23-
2+
"name": "merge",
3+
"version": "1.1.3",
4+
"author": "yeikos (http://www.yeikos.com)",
5+
"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.",
6+
"main": "merge.js",
7+
"license": "MIT",
8+
"homepage": "https://github.com/yeikos/js.merge",
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/yeikos/js.merge.git"
12+
},
13+
"keywords": [
14+
"merge",
15+
"extend",
16+
"clone",
17+
"object",
18+
"browser"
19+
],
20+
"scripts": {
21+
"test": "cd tests; node index.js"
22+
}
2423
}

0 commit comments

Comments
 (0)