Added cache.random() and node engine to package.json

This commit is contained in:
hydrabolt
2015-11-21 18:35:51 +00:00
parent 1042dfbcfe
commit 4ba90f36fe
3 changed files with 51 additions and 40 deletions

View File

@@ -83,6 +83,10 @@ var Cache = (function (_Array) {
}
};
Cache.prototype.random = function random() {
return this[Math.floor(Math.random() * this.length)];
};
Cache.prototype.remove = function remove(data) {
var index = this.indexOf(data);
if (~index) {

View File

@@ -37,5 +37,8 @@
},
"optionalDependencies": {
"node-opus": "^0.1.11"
},
"engines": {
"node": ">=0.12.7"
}
}

View File

@@ -62,6 +62,10 @@ class Cache extends Array {
}
}
random() {
return this[Math.floor(Math.random()*this.length)];
}
remove(data) {
var index = this.indexOf(data);
if (~index) {