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) { Cache.prototype.remove = function remove(data) {
var index = this.indexOf(data); var index = this.indexOf(data);
if (~index) { if (~index) {

View File

@@ -1,41 +1,44 @@
{ {
"name": "discord.js", "name": "discord.js",
"version": "5.0.1", "version": "5.0.1",
"description": "A way to interface with the Discord API", "description": "A way to interface with the Discord API",
"main": "./entrypoint.js", "main": "./entrypoint.js",
"scripts": { "scripts": {
"test": "node ./test/bot.js" "test": "node ./test/bot.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/hydrabolt/discord.js.git" "url": "git+https://github.com/hydrabolt/discord.js.git"
}, },
"keywords": [ "keywords": [
"discord", "discord",
"api", "api",
"bot", "bot",
"client", "client",
"node", "node",
"discordapp" "discordapp"
], ],
"author": "Amish Shah <amishshah.2k@gmail.com>", "author": "Amish Shah <amishshah.2k@gmail.com>",
"license": "Apache-2.0", "license": "Apache-2.0",
"bugs": { "bugs": {
"url": "https://github.com/hydrabolt/discord.js/issues" "url": "https://github.com/hydrabolt/discord.js/issues"
}, },
"homepage": "https://github.com/hydrabolt/discord.js#readme", "homepage": "https://github.com/hydrabolt/discord.js#readme",
"dependencies": { "dependencies": {
"superagent": "^1.3.0", "superagent": "^1.3.0",
"ws": "^0.7.2" "ws": "^0.7.2"
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.5", "grunt": "~0.4.5",
"grunt-babel": "^5.0.1", "grunt-babel": "^5.0.1",
"grunt-browserify": "^4.0.0", "grunt-browserify": "^4.0.0",
"grunt-contrib-uglify": "^0.9.2", "grunt-contrib-uglify": "^0.9.2",
"load-grunt-tasks": "^3.2.0" "load-grunt-tasks": "^3.2.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"node-opus": "^0.1.11" "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) { remove(data) {
var index = this.indexOf(data); var index = this.indexOf(data);
if (~index) { if (~index) {