Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bumped version 0.1.0

No more prototype extension
  • Loading branch information...
commit b4e6e1ccafbb01ab43873fb1673c228605a8174d 1 parent 13d109d
@pvorb authored
Showing with 11 additions and 18 deletions.
  1. +2 −3 README.mkd
  2. +5 −11 append.js
  3. +2 −2 package.json
  4. +2 −2 test.js
View
5 README.mkd
@@ -1,8 +1,7 @@
-**append** adds method objects that copies all the properties from one object to
-another.
+**append** one object to another.
```javascript
-Object.prototype.append(object)
+append(obj1, obj2)
```
Example
View
16 append.js
@@ -1,11 +1,5 @@
-// Not enumerable
-Object.defineProperty(Object.prototype, "append",
- {
- value: function(obj) {
- for (var prop in obj)
- if (obj[prop] != undefined)
- this[prop] = obj[prop];
- return this;
- },
- enumerable: false }
-);
+module.exports = function(o1, o2) {
+ for (var prop in o2)
+ o1[prop] = o2[prop];
+ return o1;
+};
View
4 package.json
@@ -2,7 +2,7 @@
"author": "Paul Vorbach <paul@vorb.de> (http://vorb.de)",
"name": "append",
"description": "append the properties from one object to another",
- "version": "0.0.1",
+ "version": "0.1.0",
"repository": {
"type": "git",
"url": "git://github.com/pvorb/node-append.git"
@@ -14,5 +14,5 @@
"engines": {
"node": "*"
},
- "tags": [ "object", "prototype", "append" ]
+ "tags": [ "object", "append" ]
}
View
4 test.js
@@ -1,4 +1,4 @@
-require("./");
+var append = require("./");
a = {
name: "a",
@@ -11,4 +11,4 @@ b = {
length: 6
};
-console.log(a.append(b));
+console.log(append(a, b));
Please sign in to comment.
Something went wrong with that request. Please try again.