Comparing version 0.0.1 to 0.0.2
23
index.js
@@ -1,2 +0,9 @@ | ||
Array.prototype.unique = function() { | ||
var extend = function(object, methodName, method) { | ||
Object.defineProperty(object.prototype, methodName, { | ||
enumerable: false, | ||
value: method | ||
}); | ||
}; | ||
extend(Array, "unique", function() { | ||
for (var i = 1; i < this.length; ++i) { | ||
@@ -9,5 +16,5 @@ if (this[i] == this[i - 1]) { | ||
return this; | ||
}; | ||
}); | ||
Object.prototype.merge = function(object) { | ||
extend(Object, "merge", function(object) { | ||
var objectA = object | ||
@@ -35,10 +42,10 @@ , objectB = this | ||
return merged; | ||
}; | ||
}); | ||
Date.prototype.unixTime = function() { | ||
extend(Date, "unixTime", function() { | ||
return Math.floor(this.getTime()/1000); | ||
}; | ||
}); | ||
Date.prototype.fromUnixTime = function(time) { | ||
extend(Date, "fromUnixTime", function(time) { | ||
this.setTime(time*1000); | ||
}; | ||
}); |
@@ -5,3 +5,3 @@ { | ||
"author": "Adam Blackburn <adam@ifit.com>", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "keywords": ["goodies", "merge", "unique", "unixtime"], |
@@ -28,1 +28,7 @@ # Goodies | ||
Sets the date based on the unix time passed in. | ||
### To use | ||
Install with `npm install goodies` | ||
To use goodies, just add `require('goodies')` to any js file you run in node. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3587
45
34