├── .gitattributes ├── .gitignore ├── README.md ├── bot.js ├── commands ├── announce.js ├── ban.js ├── botinfo.js ├── delete.js ├── emit.js ├── eval.js ├── help.js ├── members.js ├── myinfo.js ├── prune.js ├── reload.js ├── say.js ├── serverinfo.js ├── setbot.js ├── stop.js ├── ts.js └── unban.js ├── config-TEMPLATE.json ├── events ├── guildMemberAdd.js ├── guildMemberRemove.js ├── message.js ├── messageDelete.js ├── messageUpdate.js └── ready.js ├── node_modules ├── axios │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── UPGRADE_GUIDE.md │ ├── dist │ │ ├── axios.js │ │ ├── axios.map │ │ ├── axios.min.js │ │ └── axios.min.map │ ├── index.d.ts │ ├── index.js │ ├── lib │ │ ├── adapters │ │ │ ├── README.md │ │ │ ├── http.js │ │ │ └── xhr.js │ │ ├── axios.js │ │ ├── cancel │ │ │ ├── Cancel.js │ │ │ ├── CancelToken.js │ │ │ └── isCancel.js │ │ ├── core │ │ │ ├── Axios.js │ │ │ ├── InterceptorManager.js │ │ │ ├── README.md │ │ │ ├── createError.js │ │ │ ├── dispatchRequest.js │ │ │ ├── enhanceError.js │ │ │ ├── settle.js │ │ │ └── transformData.js │ │ ├── defaults.js │ │ ├── helpers │ │ │ ├── README.md │ │ │ ├── bind.js │ │ │ ├── btoa.js │ │ │ ├── buildURL.js │ │ │ ├── combineURLs.js │ │ │ ├── cookies.js │ │ │ ├── deprecatedMethod.js │ │ │ ├── isAbsoluteURL.js │ │ │ ├── isURLSameOrigin.js │ │ │ ├── normalizeHeaderName.js │ │ │ ├── parseHeaders.js │ │ │ └── spread.js │ │ └── utils.js │ └── package.json ├── debug │ ├── .coveralls.yml │ ├── .eslintrc │ ├── .npmignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── karma.conf.js │ ├── node.js │ ├── package.json │ └── src │ │ ├── browser.js │ │ ├── debug.js │ │ ├── index.js │ │ └── node.js ├── discord-anti-spam │ ├── LICENSE │ ├── README.md │ ├── anti_spam.js │ └── package.json ├── follow-redirects │ ├── LICENSE │ ├── README.md │ ├── http.js │ ├── https.js │ ├── index.js │ └── package.json ├── is-buffer │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ └── basic.js └── ms │ ├── index.js │ ├── license.md │ ├── package.json │ └── readme.md └── package-lock.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | config.json -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoMod Discord Bot 2 | This bot will handle miscellaeous moderation functions including an antispam filter - users who spam will be banned! It currently uses [Discord Anti-spam](https://github.com/Michael-J-Scofield/discord-anti-spam) code. 3 | 4 | To use, rename `config-TEMPLATE.json` to `config.json` and replace all values with the corect information for your bot/server. Then run the bot with `node bot.js` or `forever start bot.js` (to keep it running perpetually) 5 | 6 | It also comes with some moderation & other commands: 7 | 8 | **Moderator Commands:** 9 | - `.announce [channel] [message]` 10 | - Sends an announcement (Embed) to the specified channel 11 | - `.ban @user [reason]` 12 | - Bans the user specified, and logs to the logging channel 13 | - `.prune [user] [#]` 14 | - Deletes [#] of messages from a channel by a specified user 15 | - `.unban [userid] [reason]` 16 | - Unbans the user ID specified and logs to bot-logs channel 17 | 18 | **Admin Commands:** 19 | - `.delete [#]` 20 | - Deletes messages from a channel. Currently restricted to the Owner role, and requires the to have the 'Manage Messages' permission. 21 | - `.say [channel] [message]` 22 | - Speaks as the bot 23 | - `.setbot [type] [arguments]` 24 | - Allows you to change the bots game: .botgame [playing | listening | watching [text]. 25 | 26 | **Miscellaneous user commands:** 27 | - `.botinfo` 28 | - Displays information about AutoMod 29 | - `.help []` 30 | - Displays all commands available within this bot. 31 | - `.roleinfo [role name]` 32 | - Displays information about the entered role, including a list of users. 33 | - `.myinfo []` 34 | - Displays information relating to the user: name, roles, etc. If a user's ID is specified this will query the user, otherwise the command author will be displayed. 35 | 36 | **Owner Commands** 37 | - `.emit ` 38 | - Emits an event for testing 39 | - `.eval [script]` 40 | - Payload testing; logs variable payload to console for testing reasons. 41 | - `.reload [command]` 42 | - Reloads the bots command to allow edits to take effect. Currently this is restricted to the owner of the bot 43 | - `.stop` 44 | - Stops the bot. Currently this is restricted to the owner of the bot. 45 | - `.ts [whatever]` 46 | - Test Command Pls Ignore -------------------------------------------------------------------------------- /bot.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const client = new Discord.Client(); 3 | const fs = require("fs"); 4 | const request = require("axios"); 5 | 6 | const config = require("./config.json"); 7 | const prefix = config.prefix; 8 | 9 | let cooldown = new Set(); 10 | 11 | const antispam = require("discord-anti-spam"); 12 | 13 | antispam(client, { 14 | logChannel: config.banLogChannel, 15 | warnBuffer: config.warnBuffer, 16 | maxBuffer: config.warnBuffer, 17 | interval: config.interval, 18 | warningMessage: config.warningMessage, 19 | banMessage: config.banMessage, 20 | maxDuplicatesWarning: config.maxDuplicatesWarning, 21 | maxDuplicatesWarning: config.maxDuplicatesWarning, 22 | maxDuplicatesBan: config.maxDuplicatesBan, 23 | deleteMessagesAfterBanForPastDays: parseInt(config.deleteMessagesAfterBanForPastDays), 24 | exemptRoles: config.exemptRoles, 25 | exemptUsers: config.exemptUsers 26 | }); 27 | 28 | fs.readdir("./events/", (err, files) => { 29 | if (err) return console.error(err); 30 | files.forEach(file => { 31 | let eventFunction = require(`./events/${file}`); 32 | let eventName = file.split(".")[0]; 33 | client.on(eventName, (...args) => eventFunction.run(client, ...args)); 34 | }); 35 | }); 36 | 37 | client.on("error", (e) => { 38 | console.error(e); 39 | client.channels.find("id", config.errorLogChannel).send("**Error:** ```" + e + "```"); 40 | } 41 | ); 42 | 43 | client.on("warn", (e) => { 44 | console.warn(e); 45 | client.channels.find("id", config.errorLogChannel).send("**Warning:** ```" + e + "```"); 46 | } 47 | ); 48 | 49 | client.on("message", msg => { 50 | if (msg.author.bot) return; 51 | if (msg.content.indexOf(config.prefix) !== 0) return; 52 | if (msg.content.includes("/")) return; 53 | 54 | //parse commands 55 | const args = msg.content.slice(config.prefix.length).trim().split(/ +/g); 56 | const command = args.shift().toLowerCase(); 57 | const content = msg.content.substr(prefix.length + command.length,msg.content.length - prefix.length - command.length); 58 | 59 | //perform actions 60 | try { 61 | let commandFile = require(`./commands/${command}.js`); 62 | commandFile.run(client, msg, args, content, cooldown, command, Discord, config, request); 63 | } catch (err) { 64 | console.error(err); 65 | } 66 | 67 | }); 68 | 69 | client.login(config.token); 70 | -------------------------------------------------------------------------------- /commands/announce.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | if (msg.member.roles.find("name","Moderator") || msg.author.id == config.owner) { 3 | var sayChannel = msg.mentions.channels.first(); 4 | var sayMsg = args.splice(1, args.length - 1).join(" "); 5 | var role = msg.member.highestRole; 6 | var embed = new Discord.RichEmbed() 7 | .setColor(role.color) 8 | .setTimestamp() 9 | .setAuthor(`From ${msg.member.displayName} | ${role.name}`,`${msg.author.avatarURL}`) 10 | .setDescription(sayMsg); 11 | 12 | sayChannel.send({embed}).catch(console.error); 13 | } else { 14 | msg.channel.send("You do not have permission to use this command").catch(console.error); 15 | } 16 | }; 17 | 18 | //for !help command (mandatory or the bot will error!) 19 | exports.help = { 20 | name: "announce", 21 | category: "Mods", 22 | description: "Sends an announcement (Embed) to the specified channel", 23 | usage: "announce [channel] [message]", 24 | example: "" 25 | }; -------------------------------------------------------------------------------- /commands/ban.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | //variables 3 | var banChannel = config.banLogChannel; 4 | var banUser = msg.mentions.users.first(); 5 | var banReason = args.splice(1, args.length - 1).join(" "); 6 | var banTime = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short", weekday: "short", month: "long", day: "2-digit", year: "numeric", hour: '2-digit', minute:'2-digit'}); 7 | 8 | if (!msg.member.roles.find("name","Moderator")) { 9 | msg.channel.send("I'm sorry, you do not have permission for this command").catch(console.error); 10 | //} else if (banUser.roles.find("name","Moderator")) { 11 | // msg.channel.send("I'm sorry but you may not ban this person"); 12 | } else if (!banUser || !banReason) { 13 | msg.channel.send("The required syntax is `.ban @user [reason]`") 14 | } else { 15 | //log to ban-logs channel 16 | var embed = new Discord.RichEmbed() 17 | .setColor(0x992d22) 18 | .setTimestamp() 19 | .setTitle(`🔨 **${banUser.tag}** has been banned 🔨`) 20 | .setDescription(` 21 | **User Id:** ${banUser.id} 22 | **Banned By:** ${msg.author.tag} 23 | **Reason:** ${banReason} 24 | **When:** ${banTime} 25 | `); 26 | msg.guild.channels.find("id",`${banChannel}`).send({embed}).catch(console.error); 27 | 28 | //ban mentioned user 29 | msg.guild.ban(banUser) 30 | .then(user => console.log("Banned " + user.username + " from " + msg.guild.name)) 31 | .catch(console.error); 32 | }; 33 | }; 34 | 35 | //for !help command (mandatory or the bot will error!) 36 | exports.help = { 37 | name: "ban", 38 | category: "Mods", 39 | description: "Bans the user specified, and logs to the logging channel", 40 | usage: "ban @user [reason]", 41 | example: "", 42 | status: "Ready" 43 | }; -------------------------------------------------------------------------------- /commands/botinfo.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | //store bot's game type 3 | var game = client.user.presence.game.type; 4 | switch(game) { 5 | case 1: var gtype = "Playing"; break; 6 | case 2: var gtype = "Listening to"; break; 7 | case 3: var gtype = "Watching"; break; 8 | }; 9 | //store bots OS 10 | switch(process.platform){ 11 | case "win32": var os = "Windows"; break; 12 | case "linux": var os = "Linux"; break; 13 | case "darwin": var os = "Darwin"; break; 14 | case "openbsd": var os = "OpenBSD"; break; 15 | case "sunos": var os = "Solaris"; break; 16 | case "freebst": var os = "FreeBSD"; break; 17 | }; 18 | //store bots uptime 19 | var uptime = process.uptime(); 20 | var days = Math.floor((uptime % 31536000) / 86400); 21 | var hours = Math.floor((uptime % 86400) / 3600); 22 | var minutes = Math.floor((uptime % 3600) / 60); 23 | var seconds = Math.round(uptime % 60); 24 | var botuptime = (days > 0 ? days + " days, ":"") + (hours > 0 ? hours + " hours, ":"") + (minutes > 0 ? minutes + " minutes, ":"") + (seconds > 0 ? seconds + " seconds":""); 25 | 26 | //create embed 27 | var embed = new Discord.RichEmbed() 28 | .setAuthor(client.user.tag + " Bot Info", client.user.avatarURL) 29 | .setColor(0xff0000) 30 | .setDescription(` 31 | __General Information__ 32 | **Status**: ${client.user.presence.status} 33 | **${gtype}:** ${client.user.presence.game.name} 34 | **Uptime:** ${botuptime} 35 | **Ping**: ${Math.round(client.ping)} ms 36 | 37 | __Technical Information__ 38 | **OS:** ${os} 39 | **Memory:** ${((process.memoryUsage().heapUsed / 1024) / 1024).toFixed(2)} MB 40 | **Node.js Version:** ${process.versions.node} 41 | **Discord.js Version:** ${Discord.version} 42 | `) 43 | .setFooter(".botinfo | " + msg.author.tag) 44 | .setTimestamp(); 45 | msg.channel.send({embed}).catch(console.error); 46 | }; 47 | 48 | exports.help = { 49 | name: "botinfo", 50 | category: "Info", 51 | description: "Displays information about AutoMod", 52 | usage: "botinfo", 53 | example: "", 54 | status: "Ready" 55 | }; -------------------------------------------------------------------------------- /commands/delete.js: -------------------------------------------------------------------------------- 1 | const config = require("../config.json"); 2 | exports.run = (client, msg, args) => { 3 | if (msg.member.roles.find("name","Admin") || msg.author.id == config.owner) { 4 | var amt = args[0]; 5 | if (typeof amt === 'undefined') { 6 | msg.channel.send("You need to provide an amount to delete!").catch(console.error);; 7 | } else { 8 | msg.channel.bulkDelete(amt).then(messages => console.log(`Bulk deleted ${messages.size} messages`)).catch(console.error); 9 | } 10 | } else msg.channel.send("I'm sorry, you do not have permission for this command").catch(console.error);; 11 | 12 | }; 13 | 14 | exports.help = { 15 | name: "delete", 16 | category: "Admin", 17 | description: "Deletes messages from a channel. Currently restricted to the Owner role, and requires the to have the 'Manage Messages' permission.", 18 | usage: "delete [#]", 19 | example: "", 20 | status: "Ready" 21 | }; -------------------------------------------------------------------------------- /commands/emit.js: -------------------------------------------------------------------------------- 1 | const config = require("../config.json"); 2 | exports.run = (client, msg, args, content, cooldown, command, Discord, request) => { 3 | //variables 4 | var emitType = args[0]; 5 | 6 | if (msg.author.id !== config.owner) { 7 | msg.channel.send("I'm sorry, you do not have permission for this command").catch(console.error); 8 | } else if (typeof emitType == 'undefined') { 9 | var emitReq = "nothing"; 10 | } else { 11 | var emitReq = emitType.toUpperCase(); 12 | }; 13 | 14 | switch(emitReq) { 15 | case "MEMBERJOIN": 16 | client.emit("guildMemberAdd", msg.member); 17 | msg.channel.send("I have emitted `guildMemberAdd`"); 18 | break; 19 | case "MEMBERLEAVE": 20 | client.emit("guildMemberRemove", msg.member); 21 | msg.channel.send("I have emitted `guildMemberRemove`"); 22 | break; 23 | case "BAN": 24 | client.emit("guildBanAdd", msg.guild, msg.author); 25 | msg.channel.send("I have emitted `guildBanAdd`"); 26 | break; 27 | case "UNBAN": 28 | client.emit("guildBanRemove", msg.guild, msg.author); 29 | msg.channel.send("I have emitted `guildBanRemove`"); 30 | break; 31 | case "ERROR": 32 | msg.channel.send("I have emitted `error` - please check your log for details"); 33 | client.emit("error", "This is a test error"); 34 | break; 35 | default: 36 | msg.channel.send("The syntax for this command is `?emit ` \n\n**The types you can choose from are:** \n`memberjoin` - emitted when a member joins the guild \n`memberleave` - emitted when a member leaves the guild (either willingly or via kick) \n`ban` - emitted when a member is banned \n`unban` - emitted when a member is banned \n`error` - throws an uncaught error"); 37 | break; 38 | }; 39 | }; 40 | 41 | //for !help command (mandatory or the bot will error!) 42 | exports.help = { 43 | name: "emit", 44 | category: "Owner", 45 | description: "Emits an event for testing", 46 | usage: "emit ", 47 | example: "", 48 | status: "Ready" 49 | }; -------------------------------------------------------------------------------- /commands/eval.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | if (msg.author.id !== config.owner) { 3 | msg.channel.send("I'm sorry, only my owner can run this command.").catch(console.error);; 4 | } else { 5 | eval(content); 6 | } 7 | }; 8 | 9 | //for !help command (mandatory or the bot will error!) 10 | exports.help = { 11 | name: "eval", 12 | category: "Owner", 13 | description: "Payload testing; logs variable payload to console for testing reasons.", 14 | usage: "eval [script]", 15 | example: "", 16 | status: "Broken" 17 | }; -------------------------------------------------------------------------------- /commands/help.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 4 | var req = args[0]; 5 | 6 | //create command list 7 | var files = fs.readdirSync('./commands/'); 8 | const commands = []; 9 | for (i in files) { 10 | var cmd = files[i]; 11 | commands.push(cmd.replace(".js","")); 12 | }; 13 | 14 | //if no category is listed, display generic help text 15 | if (typeof req === 'undefined') { 16 | //loop through all commands and create a list of categories 17 | var catList = []; 18 | for (i in commands) { 19 | var cmd = require("../commands/" + commands[i] + ".js"); 20 | if (catList.indexOf(cmd.help.category) < 0) {catList.push(cmd.help.category)} 21 | }; 22 | var result = ""; 23 | for (var i = 0; i < catList.length; i++){ 24 | result += ("- " + String(catList[i] + "\n")); 25 | }; 26 | var embed = new Discord.RichEmbed() 27 | .setColor(0xE8DFEA) 28 | .setTimestamp() 29 | .setFooter(".help | " + msg.author.tag) 30 | .setDescription(`For a list of commands type **.help [category]**. \nThe categories available are: \n${result}`); 31 | msg.channel.send({embed}).catch(console.error); 32 | } else { 33 | //if category is listed, display all commands within 34 | if (req.toLowerCase() === "owner" && msg.author.id !== config.owner) { 35 | msg.channel.send("I'm sorry, you do not have permission for this command.").catch(console.error); 36 | } else { 37 | //create embed 38 | var embed = new Discord.RichEmbed() 39 | .setColor(0xE8DFEA) 40 | .setTitle(`Command Category: **${req.toUpperCase()}**`) 41 | .setTimestamp() 42 | .setFooter(".help | " + msg.author.tag) 43 | for (y in commands) { 44 | var cmd = require("../commands/" + commands[y] + ".js"); 45 | if(cmd.help.category.toLowerCase() === req.toLowerCase()) { 46 | embed.addField(`${config.prefix}${cmd.help.usage}`, `*${cmd.help.description}*`) 47 | }; 48 | }; 49 | msg.channel.send({embed}).catch(console.error); 50 | }; 51 | }; 52 | }; 53 | 54 | exports.help = { 55 | name: "help", 56 | category: "Info", 57 | description: "Displays all commands available within this bot.", 58 | usage: "help []", 59 | example: "", 60 | status: "Untested" 61 | }; -------------------------------------------------------------------------------- /commands/members.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../config.json"); 3 | exports.run = (client, msg, args) => { 4 | var input = args.join(" "); 5 | if (typeof input === 'undefined' || input == 'everyone') { 6 | msg.channel.send("Please input a valid role name").catch(console.error); 7 | } else { 8 | var role = msg.guild.roles.find("name", input); 9 | if (role === null) { 10 | msg.channel.send("Please input a valid role name").catch(console.error); 11 | } else { 12 | var list = role.members.map(m=>m.user.tag).sort(); 13 | var result = ""; 14 | for (var i = 0; i < list.length; i++){ 15 | result += ("- " + String(list[i] + "\n")); 16 | }; 17 | var embed = new Discord.RichEmbed() 18 | .setTitle("**Role Info**") 19 | .setColor(role.color) 20 | .setAuthor(client.user.tag, client.user.avatarURL) 21 | .addField("Name", role.name, true) 22 | .addField("Hoisted", role.hoist, true) 23 | .addField("Users", `${result}`) 24 | .setTimestamp() 25 | .setFooter(config.prefix +"rolinfo | " + msg.author.tag); 26 | msg.channel.send({embed}).catch(console.error); 27 | }; 28 | }; 29 | }; 30 | 31 | exports.help = { 32 | name: "roleinfo", 33 | category: "Info", 34 | description: "Displays information about the entered role, including a list of users.", 35 | usage: "roleinfo [role name]", 36 | example: "", 37 | status: "Ready" 38 | }; -------------------------------------------------------------------------------- /commands/myinfo.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | var Input = args[0]; 3 | 4 | if (typeof Input === 'undefined') { 5 | //store user roles, max 20 6 | var roles = msg.member.roles.array(); 7 | var len = roles.length; 8 | var amt = 20; 9 | if (len > amt) { 10 | var answer = roles.slice(0,amt) + " + " + (len - amt) + " more!"; 11 | } else { 12 | var answer = roles + " "; 13 | }; 14 | 15 | //create embed 16 | var embed = new Discord.RichEmbed() 17 | .setColor(0x008000) 18 | .setTimestamp() 19 | .setThumbnail(msg.author.avatarURL) 20 | .setFooter("!myinfo") 21 | .addField("**User Info**",` 22 | **Tag: ** ${msg.author.tag} 23 | **Nickname: ** ${msg.member.displayName} 24 | **ID: ** ${msg.author.id} 25 | **Avatar URL: ** [click here](${msg.author.avatarURL}) 26 | **Created At: ** ${msg.author.createdAt} 27 | `) 28 | .addField("**User Status**",` 29 | **Status**: ${msg.author.presence.status} 30 | **Playing: ** ${(msg.author.presence.game = "null" ? "None" : msg.author.presence.game)} 31 | `) 32 | .addField("**Roles**", answer); 33 | msg.channel.send({embed}).catch(console.error); 34 | } else { 35 | var UsrLookup = msg.guild.members.find("id",Input); 36 | var roles = UsrLookup.roles.array(); 37 | var len = roles.length; 38 | var amt = 20; 39 | if (len > amt) { 40 | var answer = roles.slice(0,amt) + " + " + (len - amt) + " more!"; 41 | } else { 42 | var answer = roles + " "; 43 | }; 44 | 45 | //create embed 46 | var embed = new Discord.RichEmbed() 47 | .setColor(0x008000) 48 | .setTimestamp() 49 | .setThumbnail(UsrLookup.user.avatarURL) 50 | .setFooter(".myinfo") 51 | .addField("**User Info**",` 52 | **Tag: ** ${UsrLookup.user.tag} 53 | **Nickname: ** ${UsrLookup.displayName} 54 | **ID: ** ${UsrLookup.id} 55 | **Avatar URL: ** [click here](${UsrLookup.user.avatarURL}) 56 | **Created At: ** ${UsrLookup.user.createdAt} 57 | `) 58 | .addField("**User Status**",` 59 | **Status**: ${UsrLookup.presence.status} 60 | **Playing: ** ${(UsrLookup.user.presence.game = "null" ? "None" : UsrLookup.presence.game)} 61 | `) 62 | .addField("**Roles**", answer); 63 | msg.channel.send({embed}).catch(console.error); 64 | } 65 | }; 66 | 67 | //for !help command (mandatory or the bot will error!) 68 | exports.help = { 69 | name: "myinfo", 70 | category: "Info", 71 | description: "Displays information relating to the user: name, roles, etc. If a user's ID is specified this will query the user, otherwise the command author will be displayed.", 72 | usage: "myinfo []", 73 | example: "", 74 | status: "Ready" 75 | }; -------------------------------------------------------------------------------- /commands/prune.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args) => { 2 | if (msg.member.roles.find("name","Moderator")) { 3 | var usr = msg.mentions.users.first(); 4 | var amt = args[1]; 5 | if (typeof amt === 'undefined' || !usr) { 6 | msg.channel.send("You need to provide an amount and @user to delete messages!").catch(console.error);; 7 | } else { 8 | msg.channel.fetchMessages({limit: 100}) 9 | .then ((messages) => { 10 | var filterUser = usr.id; 11 | var filtered = messages.filter(m => m.author.id === filterUser).array().slice(0, amt); 12 | msg.channel.bulkDelete(filtered).then(messages => console.log(`deleted ${messages.size} messages`)).catch(console.error); 13 | }).catch(console.error); 14 | } 15 | } else msg.channel.send("I'm sorry, you do not have permission for this command").catch(console.error); 16 | 17 | }; 18 | 19 | exports.help = { 20 | name: "prune", 21 | category: "Mods", 22 | description: "Deletes [#] of messages from a channel by a specified user", 23 | usage: "prune [user] [#]", 24 | example: "", 25 | status: "Ready" 26 | }; -------------------------------------------------------------------------------- /commands/reload.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | if (msg.author.id !== config.owner) { 3 | msg.channel.send("I'm sorry, only my owner can run this command.").catch(console.error); 4 | } else if(typeof args[0] === 'undefined') { 5 | msg.channel.send("You must provide a command name to reload. `.reload `").catch(console.error); 6 | } else { 7 | delete require.cache[require.resolve(`./${args[0]}.js`)]; 8 | msg.channel.send(`The command **${config.prefix}${args[0]}** has been reloaded`).catch(console.error); 9 | console.log(`The command ${config.prefix}${args[0]} has been reloaded`) 10 | } 11 | }; 12 | 13 | exports.help = { 14 | name: "reload", 15 | category: "Owner", 16 | description: "Reloads the bots command to allow edits to take effect. Currently this is restricted to the owner of the bot", 17 | usage: "reload [command]", 18 | example: "", 19 | status: "Ready" 20 | }; -------------------------------------------------------------------------------- /commands/say.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | if (msg.member.roles.find("name","Admin") || msg.author.id == config.owner) { 3 | var sayChannel = msg.mentions.channels.first(); 4 | var sayMsg = args.splice(1, args.length - 1).join(" "); 5 | 6 | sayChannel.send(sayMsg).catch(console.error); 7 | } else { 8 | msg.channel.send("You do not have permission to use this command").catch(console.error); 9 | } 10 | }; 11 | 12 | //for !help command (mandatory or the bot will error!) 13 | exports.help = { 14 | name: "say", 15 | category: "Admin", 16 | description: "Speaks as the bot", 17 | usage: "say [channel] [message]", 18 | example: "" 19 | }; -------------------------------------------------------------------------------- /commands/serverinfo.js: -------------------------------------------------------------------------------- 1 | const config = require("../config.json"); 2 | exports.run = (client, msg, args, content, cooldown, command, Discord, request) => { 3 | //store verification level 4 | switch (msg.guild.verificationLevel) { 5 | case 0: var vLevel = "None"; break; 6 | case 1: var vLevel = "Low"; break; 7 | case 2: var vLevel = "Medium"; break; 8 | case 3: var vLevel = "(╯°□°)╯︵ ┻━┻"; break; 9 | case 4: var vLevel = "┻━┻︵ \ (°□°)/ ︵ ┻━┻"; break; 10 | }; 11 | //store content filter 12 | switch (msg.guild.explicitContentFilter) { 13 | case 0: var cFilter = "Don't scan any messages"; break; 14 | case 1: var cFilter = "Scan messages from members without a role"; break; 15 | case 2: var cFilter = "scan messages sent by all members"; break; 16 | } 17 | //create embed 18 | var embed = new Discord.RichEmbed() 19 | .setAuthor(`Server Info: ${msg.guild.name}`) 20 | .setColor(0xff0000) 21 | .setDescription(` 22 | __General Info__ 23 | **Owner:** ${msg.guild.owner.displayName} 24 | **Available:** ${(msg.guild.available ? "Available" : "Not Available")} 25 | **Region:** ${msg.guild.region} 26 | **Creation Date:** ${msg.guild.createdAt} 27 | **Verification Level:** ${vLevel} 28 | 29 | __Misc__ 30 | **Emojis:** ${msg.guild.emojis.array().length} 31 | **Roles:** ${msg.guild.roles.array().length} 32 | **Members:** ${msg.guild.memberCount} -> Online: ${msg.guild.members.filter(m => m.user.presence.status == "online").size} | Offline: ${msg.guild.members.filter(m => m.user.presence.status == "offline").size} | Idle: ${msg.guild.members.filter(m => m.user.presence.status == "idle").size} | DND: ${msg.guild.members.filter(m => m.user.presence.status == "dnd").size} 33 | **Channels:** ${msg.guild.channels.array().length} -> Text: ${msg.guild.channels.findAll('type', 'text').length} | Voice: ${msg.guild.channels.findAll('type', 'voice').length} 34 | **AFK info:** Move to ${msg.guild.afkChannel} after ${msg.guild.afkTimeout / 60} minutes 35 | **Content Filter:** ${cFilter} 36 | `) 37 | .setFooter("?serverinfo | " + msg.author.tag) 38 | .setThumbnail(msg.guild.iconURL) 39 | .setTimestamp(); 40 | msg.channel.send({embed}).catch(console.error); 41 | 42 | }; 43 | 44 | //for !help command (mandatory or the bot will error!) 45 | exports.help = { 46 | name: "serverinfo", 47 | category: "Info", 48 | description: "Displays information about the current server", 49 | usage: "serverinfo", 50 | example: "", 51 | status: "Ready" 52 | }; -------------------------------------------------------------------------------- /commands/setbot.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | var req = args[0]; 3 | if (!msg.member.roles.find("name","Admin")) { 4 | msg.channel.send("You do not have permission for this command").catch(console.error); 5 | } else if (!args[0]){ 6 | msg.channel.send("The sytax for this command is\n `.botgame [playing | listening | watching] [text]`") 7 | } else { 8 | var acType = args[0].toLowerCase(); 9 | var activity = args.splice(1, args.length - 1).join(" "); 10 | switch(acType) { 11 | case "playing": var gtype = "Playing"; break; 12 | case "listening": var gtype = "Listening to"; break; 13 | case "watching": var gtype = "Watching"; break; 14 | default: msg.channel.send("Please input a valid type: playing | listening to | watching").catch(console.error); break; 15 | }; 16 | //client.user.setActivity("you sleep", {type: 'WATCHING'}) 17 | client.user.setActivity(activity, {type: acType.toUpperCase()}) 18 | .then(presence => console.log(`Activity set to ${client.user.presence.game.type}`)) 19 | .catch(console.error); 20 | msg.channel.send(`Bot set to **${gtype} ${activity}**`) 21 | } 22 | }; 23 | 24 | exports.help = { 25 | name: "setbot", 26 | category: "Admin", 27 | description: "Allows you to change the bots game: `.botgame [playing | listening | watching [text]`.", 28 | usage: "setbot [type] [arguments]", 29 | example: "", 30 | status: "Ready" 31 | }; -------------------------------------------------------------------------------- /commands/stop.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | if (msg.author.id !== config.owner) { 3 | msg.channel.send("I'm sorry, only my owner can run this command.").catch(console.error); 4 | } else { 5 | console.log("Stopping the bot"); 6 | process.exit(0); 7 | } 8 | }; 9 | 10 | exports.help = { 11 | name: "stop", 12 | category: "Owner", 13 | description: "Stops the bot. Currently this is restricted to the owner of the bot.", 14 | usage: "stop", 15 | example: "", 16 | status: "Ready" 17 | }; -------------------------------------------------------------------------------- /commands/ts.js: -------------------------------------------------------------------------------- 1 | const config = require("../config.json"); 2 | 3 | exports.run = (client, msg, args, content, cooldown, command, Discord, request) => { 4 | if (msg.author.id !== config.owner) { 5 | msg.channel.send("I'm sorry, only my owner can run this command.").catch(console.error); 6 | } else { 7 | msg.channel.send("What were you expecting...its a test command....").catch(console.log); 8 | } 9 | 10 | }; 11 | 12 | exports.help = { 13 | name: "ts", 14 | category: "Owner", 15 | description: "Test Command Pls Ignore", 16 | usage: "ts [whatever]", 17 | example: "", 18 | status: "Untested" 19 | }; -------------------------------------------------------------------------------- /commands/unban.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, msg, args, content, cooldown, command, Discord, config, request) => { 2 | //variables 3 | var unbanChannel = config.banLogChannel; 4 | var unbanUser = args[0]; 5 | var unbanReason = args.splice(1, args.length - 1).join(" "); 6 | var unbanTime = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short", weekday: "short", month: "long", day: "2-digit", year: "numeric", hour: '2-digit', minute:'2-digit'}); 7 | 8 | if (!msg.member.roles.find("name","Moderator")) { 9 | msg.channel.send("I'm sorry, you do not have permission for this command").catch(console.error); 10 | } else if (!unbanUser || !unbanReason) { 11 | msg.channel.send("The required syntax is `!unban @user [reason]`") 12 | } else { 13 | //log to ban-logs channel 14 | var embed = new Discord.RichEmbed() 15 | .setColor(0x008000) 16 | .setTimestamp() 17 | .setTitle(`⚖ Someone has been unbanned ⚖`) 18 | .setDescription(` 19 | **User Id:** ${unbanUser} 20 | **Unbanned By:** ${msg.author.tag} 21 | **Reason:** ${unbanReason} 22 | **When:** ${unbanTime} 23 | `); 24 | msg.guild.channels.find("id",unbanChannel).send({embed}).catch(console.error); 25 | 26 | //ban mentioned user 27 | msg.guild.unban(unbanUser) 28 | .then(user => console.log("Unbanned " + user.username + " from " + msg.guild.name)) 29 | .catch(console.error); 30 | }; 31 | }; 32 | 33 | //for !help command (mandatory or the bot will error!) 34 | exports.help = { 35 | name: "unban", 36 | category: "Mods", 37 | description: "Unbans the user ID specified and logs to bot-logs channel", 38 | usage: "unban [userid] [reason]", 39 | example: "", 40 | status: "Ready" 41 | }; -------------------------------------------------------------------------------- /config-TEMPLATE.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "bot-token here", 3 | "prefix": ".", 4 | "owner": "owner id here", 5 | "mainguildID": "guild id here", 6 | "errorLogChannel": "channel id here", 7 | "banLogChannel": "channel id here", 8 | "joinLogChannel": "channel id here", 9 | "deleteLogChannel": "channel id here", 10 | "censoredWords": ["nigga", "nigger", "https://discord.gg/", "https://www.youtube.com/"], 11 | "warnBuffer": "5", 12 | "maxBuffer": "10", 13 | "interval": "1000", 14 | "warningMessage": "stop spamming or you will be banned.", 15 | "banMessage": "has been banned for spamming.", 16 | "maxDuplicatesWarning": "7", 17 | "maxDuplicatesBan": "10", 18 | "deleteMessagesAfterBanForPastDays": "7", 19 | "exemptRoles": ["Admin", "Moderator"], 20 | "exemptUsers": ["user#0001", "user#0002"] 21 | } -------------------------------------------------------------------------------- /events/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../config.json"); 3 | 4 | exports.run = (client, member) => { 5 | //log new user 6 | var joinChannelID = config.joinLogChannel; 7 | var joinTime = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short", weekday: "short", month: "long", day: "2-digit", year: "numeric", hour: '2-digit', minute:'2-digit'}); 8 | 9 | var embed = new Discord.RichEmbed() 10 | .setColor(0x008000) 11 | .setDescription(` 12 | ${member.user} has joined the server 13 | **Tag:** ${member.user.tag} 14 | **ID:** ${member.user.id} 15 | **Created At:** ${member.user.createdAt} 16 | **Joined At: ** ${joinTime} 17 | `); 18 | client.channels.find("id", joinChannelID).send({embed}).catch(console.error); 19 | 20 | } -------------------------------------------------------------------------------- /events/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../config.json"); 3 | 4 | exports.run = (client, member) => { 5 | var leaveChannelID = config.joinLogChannel; 6 | var leaveTime = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short", weekday: "short", month: "long", day: "2-digit", year: "numeric", hour: '2-digit', minute:'2-digit'}); 7 | 8 | var embed = new Discord.RichEmbed() 9 | .setColor(0xFF0000) 10 | .setDescription(` 11 | ${member.user} has left the server 12 | **Tag:** ${member.user.tag} 13 | **ID:** ${member.user.id} 14 | **Nickname:** ${member.displayName} 15 | **Created At:** ${member.user.createdAt} 16 | **Left At: ** ${leaveTime} 17 | `); 18 | client.channels.find("id", leaveChannelID).send({embed}).catch(console.error); 19 | 20 | } -------------------------------------------------------------------------------- /events/message.js: -------------------------------------------------------------------------------- 1 | const config = require("../config.json"); 2 | 3 | exports.run = (client, message) => { 4 | //ignore bot messages 5 | if (message.author.bot) return; 6 | 7 | //chat censoring 8 | var censorList = config.censoredWords; 9 | var myMsg = message.content; 10 | for (c in censorList) { 11 | if (myMsg.includes(censorList[c])){ 12 | message.delete().catch(console.error); 13 | message.author.send(`I have deleted your message from ${message.channel}, if you believe this is in error please contact staff.`).catch(console.error); 14 | } 15 | }; 16 | 17 | }; -------------------------------------------------------------------------------- /events/messageDelete.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../config.json"); 3 | 4 | exports.run = (client, message) => { 5 | var guild = message.guild.id; 6 | var delLogChannel = config.deleteLogChannel; 7 | if (message.content.length > 1900) {var text = "*Content truncated due to length* - " + message.content.substr(0,1900)} else {var text = message.content}; 8 | var embed = new Discord.RichEmbed() 9 | .setColor(0x992d22) 10 | .setTimestamp() 11 | .setTitle(`🗑 **Message Deleted** 🗑`) 12 | .setDescription(`**Nickname:** ${message.member.displayName}\n**Tag:** ${message.author.tag}\n**From Channel:** ${message.channel.name}\n**Content:** ${text}`); 13 | client.guilds.find("id",guild).channels.find("id", delLogChannel).send({embed}).catch(console.error); 14 | }; 15 | -------------------------------------------------------------------------------- /events/messageUpdate.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require("../config.json"); 3 | 4 | exports.run = (client, oldMessage, newMessage) => { 5 | if (newMessage.author.bot) return; 6 | 7 | var guild = newMessage.guild.id; 8 | var editLogChannel = config.editLogChannel; 9 | 10 | var embed = new Discord.RichEmbed() 11 | .setColor(0xFFD700) 12 | .setTimestamp() 13 | .setTitle(`✏ **Message Edited** ✏`) 14 | .setDescription(`**Edited By:** ${newMessage.author.tag}\n**Channel:** ${newMessage.channel}`) 15 | .addField("Old Message", `${oldMessage.content}`) 16 | .addField("New Message", `${newMessage.content}`); 17 | 18 | client.guilds.find("id",guild).channels.find("id", editLogChannel).send({embed}).catch(console.error); 19 | 20 | }; 21 | -------------------------------------------------------------------------------- /events/ready.js: -------------------------------------------------------------------------------- 1 | exports.run = (client) => { 2 | var now = new Date().toLocaleString("en-US", {timeZone: "America/New_York", timeZoneName: "short", weekday: "short", month: "long", day: "2-digit", year: "numeric", hour: '2-digit', minute:'2-digit'}); 3 | 4 | client.user.setActivity("for .help", {type: 'WATCHING'}); 5 | client.channels.find("id", "527636694107815946").send(`🔄 AutoMod has restarted @ ${now}`); 6 | 7 | console.log(`Bot is ready @ ${now}`); 8 | }; -------------------------------------------------------------------------------- /node_modules/axios/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 0.18.0 (Feb 19, 2018) 4 | 5 | - Adding support for UNIX Sockets when running with Node.js ([#1070](https://github.com/axios/axios/pull/1070)) 6 | - Fixing typings ([#1177](https://github.com/axios/axios/pull/1177)): 7 | - AxiosRequestConfig.proxy: allows type false 8 | - AxiosProxyConfig: added auth field 9 | - Adding function signature in AxiosInstance interface so AxiosInstance can be invoked ([#1192](https://github.com/axios/axios/pull/1192), [#1254](https://github.com/axios/axios/pull/1254)) 10 | - Allowing maxContentLength to pass through to redirected calls as maxBodyLength in follow-redirects config ([#1287](https://github.com/axios/axios/pull/1287)) 11 | - Fixing configuration when using an instance - method can now be set ([#1342](https://github.com/axios/axios/pull/1342)) 12 | 13 | 14 | ### 0.17.1 (Nov 11, 2017) 15 | 16 | - Fixing issue with web workers ([#1160](https://github.com/axios/axios/pull/1160)) 17 | - Allowing overriding transport ([#1080](https://github.com/axios/axios/pull/1080)) 18 | - Updating TypeScript typings ([#1165](https://github.com/axios/axios/pull/1165), [#1125](https://github.com/axios/axios/pull/1125), [#1131](https://github.com/axios/axios/pull/1131)) 19 | 20 | ### 0.17.0 (Oct 21, 2017) 21 | 22 | - **BREAKING** Fixing issue with `baseURL` and interceptors ([#950](https://github.com/axios/axios/pull/950)) 23 | - **BREAKING** Improving handing of duplicate headers ([#874](https://github.com/axios/axios/pull/874)) 24 | - Adding support for disabling proxies ([#691](https://github.com/axios/axios/pull/691)) 25 | - Updating TypeScript typings with generic type parameters ([#1061](https://github.com/axios/axios/pull/1061)) 26 | 27 | ### 0.16.2 (Jun 3, 2017) 28 | 29 | - Fixing issue with including `buffer` in bundle ([#887](https://github.com/axios/axios/pull/887)) 30 | - Including underlying request in errors ([#830](https://github.com/axios/axios/pull/830)) 31 | - Convert `method` to lowercase ([#930](https://github.com/axios/axios/pull/930)) 32 | 33 | ### 0.16.1 (Apr 8, 2017) 34 | 35 | - Improving HTTP adapter to return last request in case of redirects ([#828](https://github.com/axios/axios/pull/828)) 36 | - Updating `follow-redirects` dependency ([#829](https://github.com/axios/axios/pull/829)) 37 | - Adding support for passing `Buffer` in node ([#773](https://github.com/axios/axios/pull/773)) 38 | 39 | ### 0.16.0 (Mar 31, 2017) 40 | 41 | - **BREAKING** Removing `Promise` from axios typings in favor of built-in type declarations ([#480](https://github.com/axios/axios/issues/480)) 42 | - Adding `options` shortcut method ([#461](https://github.com/axios/axios/pull/461)) 43 | - Fixing issue with using `responseType: 'json'` in browsers incompatible with XHR Level 2 ([#654](https://github.com/axios/axios/pull/654)) 44 | - Improving React Native detection ([#731](https://github.com/axios/axios/pull/731)) 45 | - Fixing `combineURLs` to support empty `relativeURL` ([#581](https://github.com/axios/axios/pull/581)) 46 | - Removing `PROTECTION_PREFIX` support ([#561](https://github.com/axios/axios/pull/561)) 47 | 48 | ### 0.15.3 (Nov 27, 2016) 49 | 50 | - Fixing issue with custom instances and global defaults ([#443](https://github.com/axios/axios/issues/443)) 51 | - Renaming `axios.d.ts` to `index.d.ts` ([#519](https://github.com/axios/axios/issues/519)) 52 | - Adding `get`, `head`, and `delete` to `defaults.headers` ([#509](https://github.com/axios/axios/issues/509)) 53 | - Fixing issue with `btoa` and IE ([#507](https://github.com/axios/axios/issues/507)) 54 | - Adding support for proxy authentication ([#483](https://github.com/axios/axios/pull/483)) 55 | - Improving HTTP adapter to use `http` protocol by default ([#493](https://github.com/axios/axios/pull/493)) 56 | - Fixing proxy issues ([#491](https://github.com/axios/axios/pull/491)) 57 | 58 | ### 0.15.2 (Oct 17, 2016) 59 | 60 | - Fixing issue with calling `cancel` after response has been received ([#482](https://github.com/axios/axios/issues/482)) 61 | 62 | ### 0.15.1 (Oct 14, 2016) 63 | 64 | - Fixing issue with UMD ([#485](https://github.com/axios/axios/issues/485)) 65 | 66 | ### 0.15.0 (Oct 10, 2016) 67 | 68 | - Adding cancellation support ([#452](https://github.com/axios/axios/pull/452)) 69 | - Moving default adapter to global defaults ([#437](https://github.com/axios/axios/pull/437)) 70 | - Fixing issue with `file` URI scheme ([#440](https://github.com/axios/axios/pull/440)) 71 | - Fixing issue with `params` objects that have no prototype ([#445](https://github.com/axios/axios/pull/445)) 72 | 73 | ### 0.14.0 (Aug 27, 2016) 74 | 75 | - **BREAKING** Updating TypeScript definitions ([#419](https://github.com/axios/axios/pull/419)) 76 | - **BREAKING** Replacing `agent` option with `httpAgent` and `httpsAgent` ([#387](https://github.com/axios/axios/pull/387)) 77 | - **BREAKING** Splitting `progress` event handlers into `onUploadProgress` and `onDownloadProgress` ([#423](https://github.com/axios/axios/pull/423)) 78 | - Adding support for `http_proxy` and `https_proxy` environment variables ([#366](https://github.com/axios/axios/pull/366)) 79 | - Fixing issue with `auth` config option and `Authorization` header ([#397](https://github.com/axios/axios/pull/397)) 80 | - Don't set XSRF header if `xsrfCookieName` is `null` ([#406](https://github.com/axios/axios/pull/406)) 81 | 82 | ### 0.13.1 (Jul 16, 2016) 83 | 84 | - Fixing issue with response data not being transformed on error ([#378](https://github.com/axios/axios/issues/378)) 85 | 86 | ### 0.13.0 (Jul 13, 2016) 87 | 88 | - **BREAKING** Improved error handling ([#345](https://github.com/axios/axios/pull/345)) 89 | - **BREAKING** Response transformer now invoked in dispatcher not adapter ([10eb238](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)) 90 | - **BREAKING** Request adapters now return a `Promise` ([157efd5](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)) 91 | - Fixing issue with `withCredentials` not being overwritten ([#343](https://github.com/axios/axios/issues/343)) 92 | - Fixing regression with request transformer being called before request interceptor ([#352](https://github.com/axios/axios/issues/352)) 93 | - Fixing custom instance defaults ([#341](https://github.com/axios/axios/issues/341)) 94 | - Fixing instances created from `axios.create` to have same API as default axios ([#217](https://github.com/axios/axios/issues/217)) 95 | 96 | ### 0.12.0 (May 31, 2016) 97 | 98 | - Adding support for `URLSearchParams` ([#317](https://github.com/axios/axios/pull/317)) 99 | - Adding `maxRedirects` option ([#307](https://github.com/axios/axios/pull/307)) 100 | 101 | ### 0.11.1 (May 17, 2016) 102 | 103 | - Fixing IE CORS support ([#313](https://github.com/axios/axios/pull/313)) 104 | - Fixing detection of `FormData` ([#325](https://github.com/axios/axios/pull/325)) 105 | - Adding `Axios` class to exports ([#321](https://github.com/axios/axios/pull/321)) 106 | 107 | ### 0.11.0 (Apr 26, 2016) 108 | 109 | - Adding support for Stream with HTTP adapter ([#296](https://github.com/axios/axios/pull/296)) 110 | - Adding support for custom HTTP status code error ranges ([#308](https://github.com/axios/axios/pull/308)) 111 | - Fixing issue with ArrayBuffer ([#299](https://github.com/axios/axios/pull/299)) 112 | 113 | ### 0.10.0 (Apr 20, 2016) 114 | 115 | - Fixing issue with some requests sending `undefined` instead of `null` ([#250](https://github.com/axios/axios/pull/250)) 116 | - Fixing basic auth for HTTP adapter ([#252](https://github.com/axios/axios/pull/252)) 117 | - Fixing request timeout for XHR adapter ([#227](https://github.com/axios/axios/pull/227)) 118 | - Fixing IE8 support by using `onreadystatechange` instead of `onload` ([#249](https://github.com/axios/axios/pull/249)) 119 | - Fixing IE9 cross domain requests ([#251](https://github.com/axios/axios/pull/251)) 120 | - Adding `maxContentLength` option ([#275](https://github.com/axios/axios/pull/275)) 121 | - Fixing XHR support for WebWorker environment ([#279](https://github.com/axios/axios/pull/279)) 122 | - Adding request instance to response ([#200](https://github.com/axios/axios/pull/200)) 123 | 124 | ### 0.9.1 (Jan 24, 2016) 125 | 126 | - Improving handling of request timeout in node ([#124](https://github.com/axios/axios/issues/124)) 127 | - Fixing network errors not rejecting ([#205](https://github.com/axios/axios/pull/205)) 128 | - Fixing issue with IE rejecting on HTTP 204 ([#201](https://github.com/axios/axios/issues/201)) 129 | - Fixing host/port when following redirects ([#198](https://github.com/axios/axios/pull/198)) 130 | 131 | ### 0.9.0 (Jan 18, 2016) 132 | 133 | - Adding support for custom adapters 134 | - Fixing Content-Type header being removed when data is false ([#195](https://github.com/axios/axios/pull/195)) 135 | - Improving XDomainRequest implementation ([#185](https://github.com/axios/axios/pull/185)) 136 | - Improving config merging and order of precedence ([#183](https://github.com/axios/axios/pull/183)) 137 | - Fixing XDomainRequest support for only <= IE9 ([#182](https://github.com/axios/axios/pull/182)) 138 | 139 | ### 0.8.1 (Dec 14, 2015) 140 | 141 | - Adding support for passing XSRF token for cross domain requests when using `withCredentials` ([#168](https://github.com/axios/axios/pull/168)) 142 | - Fixing error with format of basic auth header ([#178](https://github.com/axios/axios/pull/173)) 143 | - Fixing error with JSON payloads throwing `InvalidStateError` in some cases ([#174](https://github.com/axios/axios/pull/174)) 144 | 145 | ### 0.8.0 (Dec 11, 2015) 146 | 147 | - Adding support for creating instances of axios ([#123](https://github.com/axios/axios/pull/123)) 148 | - Fixing http adapter to use `Buffer` instead of `String` in case of `responseType === 'arraybuffer'` ([#128](https://github.com/axios/axios/pull/128)) 149 | - Adding support for using custom parameter serializer with `paramsSerializer` option ([#121](https://github.com/axios/axios/pull/121)) 150 | - Fixing issue in IE8 caused by `forEach` on `arguments` ([#127](https://github.com/axios/axios/pull/127)) 151 | - Adding support for following redirects in node ([#146](https://github.com/axios/axios/pull/146)) 152 | - Adding support for transparent decompression if `content-encoding` is set ([#149](https://github.com/axios/axios/pull/149)) 153 | - Adding support for transparent XDomainRequest to handle cross domain requests in IE9 ([#140](https://github.com/axios/axios/pull/140)) 154 | - Adding support for HTTP basic auth via Authorization header ([#167](https://github.com/axios/axios/pull/167)) 155 | - Adding support for baseURL option ([#160](https://github.com/axios/axios/pull/160)) 156 | 157 | ### 0.7.0 (Sep 29, 2015) 158 | 159 | - Fixing issue with minified bundle in IE8 ([#87](https://github.com/axios/axios/pull/87)) 160 | - Adding support for passing agent in node ([#102](https://github.com/axios/axios/pull/102)) 161 | - Adding support for returning result from `axios.spread` for chaining ([#106](https://github.com/axios/axios/pull/106)) 162 | - Fixing typescript definition ([#105](https://github.com/axios/axios/pull/105)) 163 | - Fixing default timeout config for node ([#112](https://github.com/axios/axios/pull/112)) 164 | - Adding support for use in web workers, and react-native ([#70](https://github.com/axios/axios/issue/70)), ([#98](https://github.com/axios/axios/pull/98)) 165 | - Adding support for fetch like API `axios(url[, config])` ([#116](https://github.com/axios/axios/issues/116)) 166 | 167 | ### 0.6.0 (Sep 21, 2015) 168 | 169 | - Removing deprecated success/error aliases 170 | - Fixing issue with array params not being properly encoded ([#49](https://github.com/axios/axios/pull/49)) 171 | - Fixing issue with User-Agent getting overridden ([#69](https://github.com/axios/axios/issues/69)) 172 | - Adding support for timeout config ([#56](https://github.com/axios/axios/issues/56)) 173 | - Removing es6-promise dependency 174 | - Fixing issue preventing `length` to be used as a parameter ([#91](https://github.com/axios/axios/pull/91)) 175 | - Fixing issue with IE8 ([#85](https://github.com/axios/axios/pull/85)) 176 | - Converting build to UMD 177 | 178 | ### 0.5.4 (Apr 08, 2015) 179 | 180 | - Fixing issue with FormData not being sent ([#53](https://github.com/axios/axios/issues/53)) 181 | 182 | ### 0.5.3 (Apr 07, 2015) 183 | 184 | - Using JSON.parse unconditionally when transforming response string ([#55](https://github.com/axios/axios/issues/55)) 185 | 186 | ### 0.5.2 (Mar 13, 2015) 187 | 188 | - Adding support for `statusText` in response ([#46](https://github.com/axios/axios/issues/46)) 189 | 190 | ### 0.5.1 (Mar 10, 2015) 191 | 192 | - Fixing issue using strict mode ([#45](https://github.com/axios/axios/issues/45)) 193 | - Fixing issue with standalone build ([#47](https://github.com/axios/axios/issues/47)) 194 | 195 | ### 0.5.0 (Jan 23, 2015) 196 | 197 | - Adding support for intercepetors ([#14](https://github.com/axios/axios/issues/14)) 198 | - Updating es6-promise dependency 199 | 200 | ### 0.4.2 (Dec 10, 2014) 201 | 202 | - Fixing issue with `Content-Type` when using `FormData` ([#22](https://github.com/axios/axios/issues/22)) 203 | - Adding support for TypeScript ([#25](https://github.com/axios/axios/issues/25)) 204 | - Fixing issue with standalone build ([#29](https://github.com/axios/axios/issues/29)) 205 | - Fixing issue with verbs needing to be capitalized in some browsers ([#30](https://github.com/axios/axios/issues/30)) 206 | 207 | ### 0.4.1 (Oct 15, 2014) 208 | 209 | - Adding error handling to request for node.js ([#18](https://github.com/axios/axios/issues/18)) 210 | 211 | ### 0.4.0 (Oct 03, 2014) 212 | 213 | - Adding support for `ArrayBuffer` and `ArrayBufferView` ([#10](https://github.com/axios/axios/issues/10)) 214 | - Adding support for utf-8 for node.js ([#13](https://github.com/axios/axios/issues/13)) 215 | - Adding support for SSL for node.js ([#12](https://github.com/axios/axios/issues/12)) 216 | - Fixing incorrect `Content-Type` header ([#9](https://github.com/axios/axios/issues/9)) 217 | - Adding standalone build without bundled es6-promise ([#11](https://github.com/axios/axios/issues/11)) 218 | - Deprecating `success`/`error` in favor of `then`/`catch` 219 | 220 | ### 0.3.1 (Sep 16, 2014) 221 | 222 | - Fixing missing post body when using node.js ([#3](https://github.com/axios/axios/issues/3)) 223 | 224 | ### 0.3.0 (Sep 16, 2014) 225 | 226 | - Fixing `success` and `error` to properly receive response data as individual arguments ([#8](https://github.com/axios/axios/issues/8)) 227 | - Updating `then` and `catch` to receive response data as a single object ([#6](https://github.com/axios/axios/issues/6)) 228 | - Fixing issue with `all` not working ([#7](https://github.com/axios/axios/issues/7)) 229 | 230 | ### 0.2.2 (Sep 14, 2014) 231 | 232 | - Fixing bundling with browserify ([#4](https://github.com/axios/axios/issues/4)) 233 | 234 | ### 0.2.1 (Sep 12, 2014) 235 | 236 | - Fixing build problem causing ridiculous file sizes 237 | 238 | ### 0.2.0 (Sep 12, 2014) 239 | 240 | - Adding support for `all` and `spread` 241 | - Adding support for node.js ([#1](https://github.com/axios/axios/issues/1)) 242 | 243 | ### 0.1.0 (Aug 29, 2014) 244 | 245 | - Initial release 246 | -------------------------------------------------------------------------------- /node_modules/axios/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-present Matt Zabriskie 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/axios/UPGRADE_GUIDE.md: -------------------------------------------------------------------------------- 1 | # Upgrade Guide 2 | 3 | ### 0.15.x -> 0.16.0 4 | 5 | #### `Promise` Type Declarations 6 | 7 | The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details. 8 | 9 | ### 0.13.x -> 0.14.0 10 | 11 | #### TypeScript Definitions 12 | 13 | The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax. 14 | 15 | Please use the following `import` statement to import axios in TypeScript: 16 | 17 | ```typescript 18 | import axios from 'axios'; 19 | 20 | axios.get('/foo') 21 | .then(response => console.log(response)) 22 | .catch(error => console.log(error)); 23 | ``` 24 | 25 | #### `agent` Config Option 26 | 27 | The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead. 28 | 29 | ```js 30 | { 31 | // Define a custom agent for HTTP 32 | httpAgent: new http.Agent({ keepAlive: true }), 33 | // Define a custom agent for HTTPS 34 | httpsAgent: new https.Agent({ keepAlive: true }) 35 | } 36 | ``` 37 | 38 | #### `progress` Config Option 39 | 40 | The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options. 41 | 42 | ```js 43 | { 44 | // Define a handler for upload progress events 45 | onUploadProgress: function (progressEvent) { 46 | // ... 47 | }, 48 | 49 | // Define a handler for download progress events 50 | onDownloadProgress: function (progressEvent) { 51 | // ... 52 | } 53 | } 54 | ``` 55 | 56 | ### 0.12.x -> 0.13.0 57 | 58 | The `0.13.0` release contains several changes to custom adapters and error handling. 59 | 60 | #### Error Handling 61 | 62 | Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response. 63 | 64 | ```js 65 | axios.get('/user/12345') 66 | .catch((error) => { 67 | console.log(error.message); 68 | console.log(error.code); // Not always specified 69 | console.log(error.config); // The config that was used to make the request 70 | console.log(error.response); // Only available if response was received from the server 71 | }); 72 | ``` 73 | 74 | #### Request Adapters 75 | 76 | This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter. 77 | 78 | 1. Response transformer is now called outside of adapter. 79 | 2. Request adapter returns a `Promise`. 80 | 81 | This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter. 82 | 83 | Previous code: 84 | 85 | ```js 86 | function myAdapter(resolve, reject, config) { 87 | var response = { 88 | data: transformData( 89 | responseData, 90 | responseHeaders, 91 | config.transformResponse 92 | ), 93 | status: request.status, 94 | statusText: request.statusText, 95 | headers: responseHeaders 96 | }; 97 | settle(resolve, reject, response); 98 | } 99 | ``` 100 | 101 | New code: 102 | 103 | ```js 104 | function myAdapter(config) { 105 | return new Promise(function (resolve, reject) { 106 | var response = { 107 | data: responseData, 108 | status: request.status, 109 | statusText: request.statusText, 110 | headers: responseHeaders 111 | }; 112 | settle(resolve, reject, response); 113 | }); 114 | } 115 | ``` 116 | 117 | See the related commits for more details: 118 | - [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e) 119 | - [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a) 120 | 121 | ### 0.5.x -> 0.6.0 122 | 123 | The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading. 124 | 125 | #### ES6 Promise Polyfill 126 | 127 | Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it. 128 | 129 | ```js 130 | require('es6-promise').polyfill(); 131 | var axios = require('axios'); 132 | ``` 133 | 134 | This will polyfill the global environment, and only needs to be done once. 135 | 136 | #### `axios.success`/`axios.error` 137 | 138 | The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively. 139 | 140 | ```js 141 | axios.get('some/url') 142 | .then(function (res) { 143 | /* ... */ 144 | }) 145 | .catch(function (err) { 146 | /* ... */ 147 | }); 148 | ``` 149 | 150 | #### UMD 151 | 152 | Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build. 153 | 154 | ```js 155 | // AMD 156 | require(['bower_components/axios/dist/axios'], function (axios) { 157 | /* ... */ 158 | }); 159 | 160 | // CommonJS 161 | var axios = require('axios/dist/axios'); 162 | ``` 163 | -------------------------------------------------------------------------------- /node_modules/axios/dist/axios.min.js: -------------------------------------------------------------------------------- 1 | /* axios v0.18.0 | (c) 2018 by Matt Zabriskie */ 2 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(5),u=n(6),a=r(u);a.Axios=s,a.create=function(e){return r(o.merge(u,e))},a.Cancel=n(23),a.CancelToken=n(24),a.isCancel=n(20),a.all=function(e){return Promise.all(e)},a.spread=n(25),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"[object ArrayBuffer]"===R.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===R.call(e)}function d(e){return"[object File]"===R.call(e)}function l(e){return"[object Blob]"===R.call(e)}function h(e){return"[object Function]"===R.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function w(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n 6 | * @license MIT 7 | */ 8 | e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var o=n(6),i=n(2),s=n(17),u=n(18);r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(8):"undefined"!=typeof process&&(e=n(8)),e}var i=n(2),s=n(7),u={"Content-Type":"application/x-www-form-urlencoded"},a={adapter:o(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){a.headers[e]={}}),i.forEach(["post","put","patch"],function(e){a.headers[e]=i.merge(u)}),e.exports=a},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(9),i=n(12),s=n(13),u=n(14),a=n(10),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(15);e.exports=function(e){return new Promise(function(t,f){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in l||u(e.url)||(l=new window.XDomainRequest,h="onload",m=!0,l.onprogress=function(){},l.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";d.Authorization="Basic "+c(y+":"+w)}if(l.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l[h]=function(){if(l&&(4===l.readyState||m)&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in l?s(l.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:r,status:1223===l.status?204:l.status,statusText:1223===l.status?"No Content":l.statusText,headers:n,config:e,request:l};o(t,f,i),l=null}},l.onerror=function(){f(a("Network Error",e,null,l)),l=null},l.ontimeout=function(){f(a("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=n(16),v=(e.withCredentials||u(e.url))&&e.xsrfCookieName?g.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),e.withCredentials&&(l.withCredentials=!0),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),f(e),l=null)}),void 0===p&&(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(){this.message="String contains an invalid character"}function r(e){for(var t,r,i=String(e),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new n;t=t<<8|r}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(19),s=n(20),u=n(6),a=n(21),c=n(22);e.exports=function(e){r(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||u.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); 9 | //# sourceMappingURL=axios.min.map -------------------------------------------------------------------------------- /node_modules/axios/index.d.ts: -------------------------------------------------------------------------------- 1 | export interface AxiosTransformer { 2 | (data: any, headers?: any): any; 3 | } 4 | 5 | export interface AxiosAdapter { 6 | (config: AxiosRequestConfig): AxiosPromise; 7 | } 8 | 9 | export interface AxiosBasicCredentials { 10 | username: string; 11 | password: string; 12 | } 13 | 14 | export interface AxiosProxyConfig { 15 | host: string; 16 | port: number; 17 | auth?: { 18 | username: string; 19 | password:string; 20 | } 21 | } 22 | 23 | export interface AxiosRequestConfig { 24 | url?: string; 25 | method?: string; 26 | baseURL?: string; 27 | transformRequest?: AxiosTransformer | AxiosTransformer[]; 28 | transformResponse?: AxiosTransformer | AxiosTransformer[]; 29 | headers?: any; 30 | params?: any; 31 | paramsSerializer?: (params: any) => string; 32 | data?: any; 33 | timeout?: number; 34 | withCredentials?: boolean; 35 | adapter?: AxiosAdapter; 36 | auth?: AxiosBasicCredentials; 37 | responseType?: string; 38 | xsrfCookieName?: string; 39 | xsrfHeaderName?: string; 40 | onUploadProgress?: (progressEvent: any) => void; 41 | onDownloadProgress?: (progressEvent: any) => void; 42 | maxContentLength?: number; 43 | validateStatus?: (status: number) => boolean; 44 | maxRedirects?: number; 45 | httpAgent?: any; 46 | httpsAgent?: any; 47 | proxy?: AxiosProxyConfig | false; 48 | cancelToken?: CancelToken; 49 | } 50 | 51 | export interface AxiosResponse { 52 | data: T; 53 | status: number; 54 | statusText: string; 55 | headers: any; 56 | config: AxiosRequestConfig; 57 | request?: any; 58 | } 59 | 60 | export interface AxiosError extends Error { 61 | config: AxiosRequestConfig; 62 | code?: string; 63 | request?: any; 64 | response?: AxiosResponse; 65 | } 66 | 67 | export interface AxiosPromise extends Promise> { 68 | } 69 | 70 | export interface CancelStatic { 71 | new (message?: string): Cancel; 72 | } 73 | 74 | export interface Cancel { 75 | message: string; 76 | } 77 | 78 | export interface Canceler { 79 | (message?: string): void; 80 | } 81 | 82 | export interface CancelTokenStatic { 83 | new (executor: (cancel: Canceler) => void): CancelToken; 84 | source(): CancelTokenSource; 85 | } 86 | 87 | export interface CancelToken { 88 | promise: Promise; 89 | reason?: Cancel; 90 | throwIfRequested(): void; 91 | } 92 | 93 | export interface CancelTokenSource { 94 | token: CancelToken; 95 | cancel: Canceler; 96 | } 97 | 98 | export interface AxiosInterceptorManager { 99 | use(onFulfilled?: (value: V) => V | Promise, onRejected?: (error: any) => any): number; 100 | eject(id: number): void; 101 | } 102 | 103 | export interface AxiosInstance { 104 | (config: AxiosRequestConfig): AxiosPromise; 105 | (url: string, config?: AxiosRequestConfig): AxiosPromise; 106 | defaults: AxiosRequestConfig; 107 | interceptors: { 108 | request: AxiosInterceptorManager; 109 | response: AxiosInterceptorManager; 110 | }; 111 | request(config: AxiosRequestConfig): AxiosPromise; 112 | get(url: string, config?: AxiosRequestConfig): AxiosPromise; 113 | delete(url: string, config?: AxiosRequestConfig): AxiosPromise; 114 | head(url: string, config?: AxiosRequestConfig): AxiosPromise; 115 | post(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; 116 | put(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; 117 | patch(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; 118 | } 119 | 120 | export interface AxiosStatic extends AxiosInstance { 121 | create(config?: AxiosRequestConfig): AxiosInstance; 122 | Cancel: CancelStatic; 123 | CancelToken: CancelTokenStatic; 124 | isCancel(value: any): boolean; 125 | all(values: (T | Promise)[]): Promise; 126 | spread(callback: (...args: T[]) => R): (array: T[]) => R; 127 | } 128 | 129 | declare const Axios: AxiosStatic; 130 | 131 | export default Axios; 132 | -------------------------------------------------------------------------------- /node_modules/axios/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/axios'); -------------------------------------------------------------------------------- /node_modules/axios/lib/adapters/README.md: -------------------------------------------------------------------------------- 1 | # axios // adapters 2 | 3 | The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received. 4 | 5 | ## Example 6 | 7 | ```js 8 | var settle = require('./../core/settle'); 9 | 10 | module.exports = function myAdapter(config) { 11 | // At this point: 12 | // - config has been merged with defaults 13 | // - request transformers have already run 14 | // - request interceptors have already run 15 | 16 | // Make the request using config provided 17 | // Upon response settle the Promise 18 | 19 | return new Promise(function(resolve, reject) { 20 | 21 | var response = { 22 | data: responseData, 23 | status: request.status, 24 | statusText: request.statusText, 25 | headers: responseHeaders, 26 | config: config, 27 | request: request 28 | }; 29 | 30 | settle(resolve, reject, response); 31 | 32 | // From here: 33 | // - response transformers will run 34 | // - response interceptors will run 35 | }); 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /node_modules/axios/lib/adapters/http.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | var settle = require('./../core/settle'); 5 | var buildURL = require('./../helpers/buildURL'); 6 | var http = require('http'); 7 | var https = require('https'); 8 | var httpFollow = require('follow-redirects').http; 9 | var httpsFollow = require('follow-redirects').https; 10 | var url = require('url'); 11 | var zlib = require('zlib'); 12 | var pkg = require('./../../package.json'); 13 | var createError = require('../core/createError'); 14 | var enhanceError = require('../core/enhanceError'); 15 | 16 | /*eslint consistent-return:0*/ 17 | module.exports = function httpAdapter(config) { 18 | return new Promise(function dispatchHttpRequest(resolve, reject) { 19 | var data = config.data; 20 | var headers = config.headers; 21 | var timer; 22 | 23 | // Set User-Agent (required by some servers) 24 | // Only set header if it hasn't been set in config 25 | // See https://github.com/axios/axios/issues/69 26 | if (!headers['User-Agent'] && !headers['user-agent']) { 27 | headers['User-Agent'] = 'axios/' + pkg.version; 28 | } 29 | 30 | if (data && !utils.isStream(data)) { 31 | if (Buffer.isBuffer(data)) { 32 | // Nothing to do... 33 | } else if (utils.isArrayBuffer(data)) { 34 | data = new Buffer(new Uint8Array(data)); 35 | } else if (utils.isString(data)) { 36 | data = new Buffer(data, 'utf-8'); 37 | } else { 38 | return reject(createError( 39 | 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', 40 | config 41 | )); 42 | } 43 | 44 | // Add Content-Length header if data exists 45 | headers['Content-Length'] = data.length; 46 | } 47 | 48 | // HTTP basic authentication 49 | var auth = undefined; 50 | if (config.auth) { 51 | var username = config.auth.username || ''; 52 | var password = config.auth.password || ''; 53 | auth = username + ':' + password; 54 | } 55 | 56 | // Parse url 57 | var parsed = url.parse(config.url); 58 | var protocol = parsed.protocol || 'http:'; 59 | 60 | if (!auth && parsed.auth) { 61 | var urlAuth = parsed.auth.split(':'); 62 | var urlUsername = urlAuth[0] || ''; 63 | var urlPassword = urlAuth[1] || ''; 64 | auth = urlUsername + ':' + urlPassword; 65 | } 66 | 67 | if (auth) { 68 | delete headers.Authorization; 69 | } 70 | 71 | var isHttps = protocol === 'https:'; 72 | var agent = isHttps ? config.httpsAgent : config.httpAgent; 73 | 74 | var options = { 75 | path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), 76 | method: config.method, 77 | headers: headers, 78 | agent: agent, 79 | auth: auth 80 | }; 81 | 82 | if (config.socketPath) { 83 | options.socketPath = config.socketPath; 84 | } else { 85 | options.hostname = parsed.hostname; 86 | options.port = parsed.port; 87 | } 88 | 89 | var proxy = config.proxy; 90 | if (!proxy && proxy !== false) { 91 | var proxyEnv = protocol.slice(0, -1) + '_proxy'; 92 | var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; 93 | if (proxyUrl) { 94 | var parsedProxyUrl = url.parse(proxyUrl); 95 | proxy = { 96 | host: parsedProxyUrl.hostname, 97 | port: parsedProxyUrl.port 98 | }; 99 | 100 | if (parsedProxyUrl.auth) { 101 | var proxyUrlAuth = parsedProxyUrl.auth.split(':'); 102 | proxy.auth = { 103 | username: proxyUrlAuth[0], 104 | password: proxyUrlAuth[1] 105 | }; 106 | } 107 | } 108 | } 109 | 110 | if (proxy) { 111 | options.hostname = proxy.host; 112 | options.host = proxy.host; 113 | options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); 114 | options.port = proxy.port; 115 | options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path; 116 | 117 | // Basic proxy authorization 118 | if (proxy.auth) { 119 | var base64 = new Buffer(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); 120 | options.headers['Proxy-Authorization'] = 'Basic ' + base64; 121 | } 122 | } 123 | 124 | var transport; 125 | if (config.transport) { 126 | transport = config.transport; 127 | } else if (config.maxRedirects === 0) { 128 | transport = isHttps ? https : http; 129 | } else { 130 | if (config.maxRedirects) { 131 | options.maxRedirects = config.maxRedirects; 132 | } 133 | transport = isHttps ? httpsFollow : httpFollow; 134 | } 135 | 136 | if (config.maxContentLength && config.maxContentLength > -1) { 137 | options.maxBodyLength = config.maxContentLength; 138 | } 139 | 140 | // Create the request 141 | var req = transport.request(options, function handleResponse(res) { 142 | if (req.aborted) return; 143 | 144 | // Response has been received so kill timer that handles request timeout 145 | clearTimeout(timer); 146 | timer = null; 147 | 148 | // uncompress the response body transparently if required 149 | var stream = res; 150 | switch (res.headers['content-encoding']) { 151 | /*eslint default-case:0*/ 152 | case 'gzip': 153 | case 'compress': 154 | case 'deflate': 155 | // add the unzipper to the body stream processing pipeline 156 | stream = stream.pipe(zlib.createUnzip()); 157 | 158 | // remove the content-encoding in order to not confuse downstream operations 159 | delete res.headers['content-encoding']; 160 | break; 161 | } 162 | 163 | // return the last request in case of redirects 164 | var lastRequest = res.req || req; 165 | 166 | var response = { 167 | status: res.statusCode, 168 | statusText: res.statusMessage, 169 | headers: res.headers, 170 | config: config, 171 | request: lastRequest 172 | }; 173 | 174 | if (config.responseType === 'stream') { 175 | response.data = stream; 176 | settle(resolve, reject, response); 177 | } else { 178 | var responseBuffer = []; 179 | stream.on('data', function handleStreamData(chunk) { 180 | responseBuffer.push(chunk); 181 | 182 | // make sure the content length is not over the maxContentLength if specified 183 | if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { 184 | reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', 185 | config, null, lastRequest)); 186 | } 187 | }); 188 | 189 | stream.on('error', function handleStreamError(err) { 190 | if (req.aborted) return; 191 | reject(enhanceError(err, config, null, lastRequest)); 192 | }); 193 | 194 | stream.on('end', function handleStreamEnd() { 195 | var responseData = Buffer.concat(responseBuffer); 196 | if (config.responseType !== 'arraybuffer') { 197 | responseData = responseData.toString('utf8'); 198 | } 199 | 200 | response.data = responseData; 201 | settle(resolve, reject, response); 202 | }); 203 | } 204 | }); 205 | 206 | // Handle errors 207 | req.on('error', function handleRequestError(err) { 208 | if (req.aborted) return; 209 | reject(enhanceError(err, config, null, req)); 210 | }); 211 | 212 | // Handle request timeout 213 | if (config.timeout && !timer) { 214 | timer = setTimeout(function handleRequestTimeout() { 215 | req.abort(); 216 | reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); 217 | }, config.timeout); 218 | } 219 | 220 | if (config.cancelToken) { 221 | // Handle cancellation 222 | config.cancelToken.promise.then(function onCanceled(cancel) { 223 | if (req.aborted) return; 224 | 225 | req.abort(); 226 | reject(cancel); 227 | }); 228 | } 229 | 230 | // Send the request 231 | if (utils.isStream(data)) { 232 | data.pipe(req); 233 | } else { 234 | req.end(data); 235 | } 236 | }); 237 | }; 238 | -------------------------------------------------------------------------------- /node_modules/axios/lib/adapters/xhr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | var settle = require('./../core/settle'); 5 | var buildURL = require('./../helpers/buildURL'); 6 | var parseHeaders = require('./../helpers/parseHeaders'); 7 | var isURLSameOrigin = require('./../helpers/isURLSameOrigin'); 8 | var createError = require('../core/createError'); 9 | var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || require('./../helpers/btoa'); 10 | 11 | module.exports = function xhrAdapter(config) { 12 | return new Promise(function dispatchXhrRequest(resolve, reject) { 13 | var requestData = config.data; 14 | var requestHeaders = config.headers; 15 | 16 | if (utils.isFormData(requestData)) { 17 | delete requestHeaders['Content-Type']; // Let the browser set it 18 | } 19 | 20 | var request = new XMLHttpRequest(); 21 | var loadEvent = 'onreadystatechange'; 22 | var xDomain = false; 23 | 24 | // For IE 8/9 CORS support 25 | // Only supports POST and GET calls and doesn't returns the response headers. 26 | // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest. 27 | if (process.env.NODE_ENV !== 'test' && 28 | typeof window !== 'undefined' && 29 | window.XDomainRequest && !('withCredentials' in request) && 30 | !isURLSameOrigin(config.url)) { 31 | request = new window.XDomainRequest(); 32 | loadEvent = 'onload'; 33 | xDomain = true; 34 | request.onprogress = function handleProgress() {}; 35 | request.ontimeout = function handleTimeout() {}; 36 | } 37 | 38 | // HTTP basic authentication 39 | if (config.auth) { 40 | var username = config.auth.username || ''; 41 | var password = config.auth.password || ''; 42 | requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 43 | } 44 | 45 | request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); 46 | 47 | // Set the request timeout in MS 48 | request.timeout = config.timeout; 49 | 50 | // Listen for ready state 51 | request[loadEvent] = function handleLoad() { 52 | if (!request || (request.readyState !== 4 && !xDomain)) { 53 | return; 54 | } 55 | 56 | // The request errored out and we didn't get a response, this will be 57 | // handled by onerror instead 58 | // With one exception: request that using file: protocol, most browsers 59 | // will return status as 0 even though it's a successful request 60 | if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 61 | return; 62 | } 63 | 64 | // Prepare the response 65 | var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 66 | var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 67 | var response = { 68 | data: responseData, 69 | // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201) 70 | status: request.status === 1223 ? 204 : request.status, 71 | statusText: request.status === 1223 ? 'No Content' : request.statusText, 72 | headers: responseHeaders, 73 | config: config, 74 | request: request 75 | }; 76 | 77 | settle(resolve, reject, response); 78 | 79 | // Clean up request 80 | request = null; 81 | }; 82 | 83 | // Handle low level network errors 84 | request.onerror = function handleError() { 85 | // Real errors are hidden from us by the browser 86 | // onerror should only fire if it's a network error 87 | reject(createError('Network Error', config, null, request)); 88 | 89 | // Clean up request 90 | request = null; 91 | }; 92 | 93 | // Handle timeout 94 | request.ontimeout = function handleTimeout() { 95 | reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', 96 | request)); 97 | 98 | // Clean up request 99 | request = null; 100 | }; 101 | 102 | // Add xsrf header 103 | // This is only done if running in a standard browser environment. 104 | // Specifically not if we're in a web worker, or react-native. 105 | if (utils.isStandardBrowserEnv()) { 106 | var cookies = require('./../helpers/cookies'); 107 | 108 | // Add xsrf header 109 | var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? 110 | cookies.read(config.xsrfCookieName) : 111 | undefined; 112 | 113 | if (xsrfValue) { 114 | requestHeaders[config.xsrfHeaderName] = xsrfValue; 115 | } 116 | } 117 | 118 | // Add headers to the request 119 | if ('setRequestHeader' in request) { 120 | utils.forEach(requestHeaders, function setRequestHeader(val, key) { 121 | if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 122 | // Remove Content-Type if data is undefined 123 | delete requestHeaders[key]; 124 | } else { 125 | // Otherwise add header to the request 126 | request.setRequestHeader(key, val); 127 | } 128 | }); 129 | } 130 | 131 | // Add withCredentials to request if needed 132 | if (config.withCredentials) { 133 | request.withCredentials = true; 134 | } 135 | 136 | // Add responseType to request if needed 137 | if (config.responseType) { 138 | try { 139 | request.responseType = config.responseType; 140 | } catch (e) { 141 | // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 142 | // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 143 | if (config.responseType !== 'json') { 144 | throw e; 145 | } 146 | } 147 | } 148 | 149 | // Handle progress if needed 150 | if (typeof config.onDownloadProgress === 'function') { 151 | request.addEventListener('progress', config.onDownloadProgress); 152 | } 153 | 154 | // Not all browsers support upload events 155 | if (typeof config.onUploadProgress === 'function' && request.upload) { 156 | request.upload.addEventListener('progress', config.onUploadProgress); 157 | } 158 | 159 | if (config.cancelToken) { 160 | // Handle cancellation 161 | config.cancelToken.promise.then(function onCanceled(cancel) { 162 | if (!request) { 163 | return; 164 | } 165 | 166 | request.abort(); 167 | reject(cancel); 168 | // Clean up request 169 | request = null; 170 | }); 171 | } 172 | 173 | if (requestData === undefined) { 174 | requestData = null; 175 | } 176 | 177 | // Send the request 178 | request.send(requestData); 179 | }); 180 | }; 181 | -------------------------------------------------------------------------------- /node_modules/axios/lib/axios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./utils'); 4 | var bind = require('./helpers/bind'); 5 | var Axios = require('./core/Axios'); 6 | var defaults = require('./defaults'); 7 | 8 | /** 9 | * Create an instance of Axios 10 | * 11 | * @param {Object} defaultConfig The default config for the instance 12 | * @return {Axios} A new instance of Axios 13 | */ 14 | function createInstance(defaultConfig) { 15 | var context = new Axios(defaultConfig); 16 | var instance = bind(Axios.prototype.request, context); 17 | 18 | // Copy axios.prototype to instance 19 | utils.extend(instance, Axios.prototype, context); 20 | 21 | // Copy context to instance 22 | utils.extend(instance, context); 23 | 24 | return instance; 25 | } 26 | 27 | // Create the default instance to be exported 28 | var axios = createInstance(defaults); 29 | 30 | // Expose Axios class to allow class inheritance 31 | axios.Axios = Axios; 32 | 33 | // Factory for creating new instances 34 | axios.create = function create(instanceConfig) { 35 | return createInstance(utils.merge(defaults, instanceConfig)); 36 | }; 37 | 38 | // Expose Cancel & CancelToken 39 | axios.Cancel = require('./cancel/Cancel'); 40 | axios.CancelToken = require('./cancel/CancelToken'); 41 | axios.isCancel = require('./cancel/isCancel'); 42 | 43 | // Expose all/spread 44 | axios.all = function all(promises) { 45 | return Promise.all(promises); 46 | }; 47 | axios.spread = require('./helpers/spread'); 48 | 49 | module.exports = axios; 50 | 51 | // Allow use of default import syntax in TypeScript 52 | module.exports.default = axios; 53 | -------------------------------------------------------------------------------- /node_modules/axios/lib/cancel/Cancel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * A `Cancel` is an object that is thrown when an operation is canceled. 5 | * 6 | * @class 7 | * @param {string=} message The message. 8 | */ 9 | function Cancel(message) { 10 | this.message = message; 11 | } 12 | 13 | Cancel.prototype.toString = function toString() { 14 | return 'Cancel' + (this.message ? ': ' + this.message : ''); 15 | }; 16 | 17 | Cancel.prototype.__CANCEL__ = true; 18 | 19 | module.exports = Cancel; 20 | -------------------------------------------------------------------------------- /node_modules/axios/lib/cancel/CancelToken.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Cancel = require('./Cancel'); 4 | 5 | /** 6 | * A `CancelToken` is an object that can be used to request cancellation of an operation. 7 | * 8 | * @class 9 | * @param {Function} executor The executor function. 10 | */ 11 | function CancelToken(executor) { 12 | if (typeof executor !== 'function') { 13 | throw new TypeError('executor must be a function.'); 14 | } 15 | 16 | var resolvePromise; 17 | this.promise = new Promise(function promiseExecutor(resolve) { 18 | resolvePromise = resolve; 19 | }); 20 | 21 | var token = this; 22 | executor(function cancel(message) { 23 | if (token.reason) { 24 | // Cancellation has already been requested 25 | return; 26 | } 27 | 28 | token.reason = new Cancel(message); 29 | resolvePromise(token.reason); 30 | }); 31 | } 32 | 33 | /** 34 | * Throws a `Cancel` if cancellation has been requested. 35 | */ 36 | CancelToken.prototype.throwIfRequested = function throwIfRequested() { 37 | if (this.reason) { 38 | throw this.reason; 39 | } 40 | }; 41 | 42 | /** 43 | * Returns an object that contains a new `CancelToken` and a function that, when called, 44 | * cancels the `CancelToken`. 45 | */ 46 | CancelToken.source = function source() { 47 | var cancel; 48 | var token = new CancelToken(function executor(c) { 49 | cancel = c; 50 | }); 51 | return { 52 | token: token, 53 | cancel: cancel 54 | }; 55 | }; 56 | 57 | module.exports = CancelToken; 58 | -------------------------------------------------------------------------------- /node_modules/axios/lib/cancel/isCancel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function isCancel(value) { 4 | return !!(value && value.__CANCEL__); 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/Axios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var defaults = require('./../defaults'); 4 | var utils = require('./../utils'); 5 | var InterceptorManager = require('./InterceptorManager'); 6 | var dispatchRequest = require('./dispatchRequest'); 7 | 8 | /** 9 | * Create a new instance of Axios 10 | * 11 | * @param {Object} instanceConfig The default config for the instance 12 | */ 13 | function Axios(instanceConfig) { 14 | this.defaults = instanceConfig; 15 | this.interceptors = { 16 | request: new InterceptorManager(), 17 | response: new InterceptorManager() 18 | }; 19 | } 20 | 21 | /** 22 | * Dispatch a request 23 | * 24 | * @param {Object} config The config specific for this request (merged with this.defaults) 25 | */ 26 | Axios.prototype.request = function request(config) { 27 | /*eslint no-param-reassign:0*/ 28 | // Allow for axios('example/url'[, config]) a la fetch API 29 | if (typeof config === 'string') { 30 | config = utils.merge({ 31 | url: arguments[0] 32 | }, arguments[1]); 33 | } 34 | 35 | config = utils.merge(defaults, {method: 'get'}, this.defaults, config); 36 | config.method = config.method.toLowerCase(); 37 | 38 | // Hook up interceptors middleware 39 | var chain = [dispatchRequest, undefined]; 40 | var promise = Promise.resolve(config); 41 | 42 | this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 43 | chain.unshift(interceptor.fulfilled, interceptor.rejected); 44 | }); 45 | 46 | this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 47 | chain.push(interceptor.fulfilled, interceptor.rejected); 48 | }); 49 | 50 | while (chain.length) { 51 | promise = promise.then(chain.shift(), chain.shift()); 52 | } 53 | 54 | return promise; 55 | }; 56 | 57 | // Provide aliases for supported request methods 58 | utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 59 | /*eslint func-names:0*/ 60 | Axios.prototype[method] = function(url, config) { 61 | return this.request(utils.merge(config || {}, { 62 | method: method, 63 | url: url 64 | })); 65 | }; 66 | }); 67 | 68 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 69 | /*eslint func-names:0*/ 70 | Axios.prototype[method] = function(url, data, config) { 71 | return this.request(utils.merge(config || {}, { 72 | method: method, 73 | url: url, 74 | data: data 75 | })); 76 | }; 77 | }); 78 | 79 | module.exports = Axios; 80 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/InterceptorManager.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | function InterceptorManager() { 6 | this.handlers = []; 7 | } 8 | 9 | /** 10 | * Add a new interceptor to the stack 11 | * 12 | * @param {Function} fulfilled The function to handle `then` for a `Promise` 13 | * @param {Function} rejected The function to handle `reject` for a `Promise` 14 | * 15 | * @return {Number} An ID used to remove interceptor later 16 | */ 17 | InterceptorManager.prototype.use = function use(fulfilled, rejected) { 18 | this.handlers.push({ 19 | fulfilled: fulfilled, 20 | rejected: rejected 21 | }); 22 | return this.handlers.length - 1; 23 | }; 24 | 25 | /** 26 | * Remove an interceptor from the stack 27 | * 28 | * @param {Number} id The ID that was returned by `use` 29 | */ 30 | InterceptorManager.prototype.eject = function eject(id) { 31 | if (this.handlers[id]) { 32 | this.handlers[id] = null; 33 | } 34 | }; 35 | 36 | /** 37 | * Iterate over all the registered interceptors 38 | * 39 | * This method is particularly useful for skipping over any 40 | * interceptors that may have become `null` calling `eject`. 41 | * 42 | * @param {Function} fn The function to call for each interceptor 43 | */ 44 | InterceptorManager.prototype.forEach = function forEach(fn) { 45 | utils.forEach(this.handlers, function forEachHandler(h) { 46 | if (h !== null) { 47 | fn(h); 48 | } 49 | }); 50 | }; 51 | 52 | module.exports = InterceptorManager; 53 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/README.md: -------------------------------------------------------------------------------- 1 | # axios // core 2 | 3 | The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are: 4 | 5 | - Dispatching requests 6 | - Managing interceptors 7 | - Handling config 8 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/createError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var enhanceError = require('./enhanceError'); 4 | 5 | /** 6 | * Create an Error with the specified message, config, error code, request and response. 7 | * 8 | * @param {string} message The error message. 9 | * @param {Object} config The config. 10 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). 11 | * @param {Object} [request] The request. 12 | * @param {Object} [response] The response. 13 | * @returns {Error} The created error. 14 | */ 15 | module.exports = function createError(message, config, code, request, response) { 16 | var error = new Error(message); 17 | return enhanceError(error, config, code, request, response); 18 | }; 19 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/dispatchRequest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | var transformData = require('./transformData'); 5 | var isCancel = require('../cancel/isCancel'); 6 | var defaults = require('../defaults'); 7 | var isAbsoluteURL = require('./../helpers/isAbsoluteURL'); 8 | var combineURLs = require('./../helpers/combineURLs'); 9 | 10 | /** 11 | * Throws a `Cancel` if cancellation has been requested. 12 | */ 13 | function throwIfCancellationRequested(config) { 14 | if (config.cancelToken) { 15 | config.cancelToken.throwIfRequested(); 16 | } 17 | } 18 | 19 | /** 20 | * Dispatch a request to the server using the configured adapter. 21 | * 22 | * @param {object} config The config that is to be used for the request 23 | * @returns {Promise} The Promise to be fulfilled 24 | */ 25 | module.exports = function dispatchRequest(config) { 26 | throwIfCancellationRequested(config); 27 | 28 | // Support baseURL config 29 | if (config.baseURL && !isAbsoluteURL(config.url)) { 30 | config.url = combineURLs(config.baseURL, config.url); 31 | } 32 | 33 | // Ensure headers exist 34 | config.headers = config.headers || {}; 35 | 36 | // Transform request data 37 | config.data = transformData( 38 | config.data, 39 | config.headers, 40 | config.transformRequest 41 | ); 42 | 43 | // Flatten headers 44 | config.headers = utils.merge( 45 | config.headers.common || {}, 46 | config.headers[config.method] || {}, 47 | config.headers || {} 48 | ); 49 | 50 | utils.forEach( 51 | ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 52 | function cleanHeaderConfig(method) { 53 | delete config.headers[method]; 54 | } 55 | ); 56 | 57 | var adapter = config.adapter || defaults.adapter; 58 | 59 | return adapter(config).then(function onAdapterResolution(response) { 60 | throwIfCancellationRequested(config); 61 | 62 | // Transform response data 63 | response.data = transformData( 64 | response.data, 65 | response.headers, 66 | config.transformResponse 67 | ); 68 | 69 | return response; 70 | }, function onAdapterRejection(reason) { 71 | if (!isCancel(reason)) { 72 | throwIfCancellationRequested(config); 73 | 74 | // Transform response data 75 | if (reason && reason.response) { 76 | reason.response.data = transformData( 77 | reason.response.data, 78 | reason.response.headers, 79 | config.transformResponse 80 | ); 81 | } 82 | } 83 | 84 | return Promise.reject(reason); 85 | }); 86 | }; 87 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/enhanceError.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Update an Error with the specified config, error code, and response. 5 | * 6 | * @param {Error} error The error to update. 7 | * @param {Object} config The config. 8 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). 9 | * @param {Object} [request] The request. 10 | * @param {Object} [response] The response. 11 | * @returns {Error} The error. 12 | */ 13 | module.exports = function enhanceError(error, config, code, request, response) { 14 | error.config = config; 15 | if (code) { 16 | error.code = code; 17 | } 18 | error.request = request; 19 | error.response = response; 20 | return error; 21 | }; 22 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/settle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createError = require('./createError'); 4 | 5 | /** 6 | * Resolve or reject a Promise based on response status. 7 | * 8 | * @param {Function} resolve A function that resolves the promise. 9 | * @param {Function} reject A function that rejects the promise. 10 | * @param {object} response The response. 11 | */ 12 | module.exports = function settle(resolve, reject, response) { 13 | var validateStatus = response.config.validateStatus; 14 | // Note: status is not exposed by XDomainRequest 15 | if (!response.status || !validateStatus || validateStatus(response.status)) { 16 | resolve(response); 17 | } else { 18 | reject(createError( 19 | 'Request failed with status code ' + response.status, 20 | response.config, 21 | null, 22 | response.request, 23 | response 24 | )); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /node_modules/axios/lib/core/transformData.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | /** 6 | * Transform the data for a request or a response 7 | * 8 | * @param {Object|String} data The data to be transformed 9 | * @param {Array} headers The headers for the request or response 10 | * @param {Array|Function} fns A single function or Array of functions 11 | * @returns {*} The resulting transformed data 12 | */ 13 | module.exports = function transformData(data, headers, fns) { 14 | /*eslint no-param-reassign:0*/ 15 | utils.forEach(fns, function transform(fn) { 16 | data = fn(data, headers); 17 | }); 18 | 19 | return data; 20 | }; 21 | -------------------------------------------------------------------------------- /node_modules/axios/lib/defaults.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./utils'); 4 | var normalizeHeaderName = require('./helpers/normalizeHeaderName'); 5 | 6 | var DEFAULT_CONTENT_TYPE = { 7 | 'Content-Type': 'application/x-www-form-urlencoded' 8 | }; 9 | 10 | function setContentTypeIfUnset(headers, value) { 11 | if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 12 | headers['Content-Type'] = value; 13 | } 14 | } 15 | 16 | function getDefaultAdapter() { 17 | var adapter; 18 | if (typeof XMLHttpRequest !== 'undefined') { 19 | // For browsers use XHR adapter 20 | adapter = require('./adapters/xhr'); 21 | } else if (typeof process !== 'undefined') { 22 | // For node use HTTP adapter 23 | adapter = require('./adapters/http'); 24 | } 25 | return adapter; 26 | } 27 | 28 | var defaults = { 29 | adapter: getDefaultAdapter(), 30 | 31 | transformRequest: [function transformRequest(data, headers) { 32 | normalizeHeaderName(headers, 'Content-Type'); 33 | if (utils.isFormData(data) || 34 | utils.isArrayBuffer(data) || 35 | utils.isBuffer(data) || 36 | utils.isStream(data) || 37 | utils.isFile(data) || 38 | utils.isBlob(data) 39 | ) { 40 | return data; 41 | } 42 | if (utils.isArrayBufferView(data)) { 43 | return data.buffer; 44 | } 45 | if (utils.isURLSearchParams(data)) { 46 | setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 47 | return data.toString(); 48 | } 49 | if (utils.isObject(data)) { 50 | setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 51 | return JSON.stringify(data); 52 | } 53 | return data; 54 | }], 55 | 56 | transformResponse: [function transformResponse(data) { 57 | /*eslint no-param-reassign:0*/ 58 | if (typeof data === 'string') { 59 | try { 60 | data = JSON.parse(data); 61 | } catch (e) { /* Ignore */ } 62 | } 63 | return data; 64 | }], 65 | 66 | /** 67 | * A timeout in milliseconds to abort a request. If set to 0 (default) a 68 | * timeout is not created. 69 | */ 70 | timeout: 0, 71 | 72 | xsrfCookieName: 'XSRF-TOKEN', 73 | xsrfHeaderName: 'X-XSRF-TOKEN', 74 | 75 | maxContentLength: -1, 76 | 77 | validateStatus: function validateStatus(status) { 78 | return status >= 200 && status < 300; 79 | } 80 | }; 81 | 82 | defaults.headers = { 83 | common: { 84 | 'Accept': 'application/json, text/plain, */*' 85 | } 86 | }; 87 | 88 | utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 89 | defaults.headers[method] = {}; 90 | }); 91 | 92 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 93 | defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 94 | }); 95 | 96 | module.exports = defaults; 97 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/README.md: -------------------------------------------------------------------------------- 1 | # axios // helpers 2 | 3 | The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like: 4 | 5 | - Browser polyfills 6 | - Managing cookies 7 | - Parsing HTTP headers 8 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/bind.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function bind(fn, thisArg) { 4 | return function wrap() { 5 | var args = new Array(arguments.length); 6 | for (var i = 0; i < args.length; i++) { 7 | args[i] = arguments[i]; 8 | } 9 | return fn.apply(thisArg, args); 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/btoa.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js 4 | 5 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 6 | 7 | function E() { 8 | this.message = 'String contains an invalid character'; 9 | } 10 | E.prototype = new Error; 11 | E.prototype.code = 5; 12 | E.prototype.name = 'InvalidCharacterError'; 13 | 14 | function btoa(input) { 15 | var str = String(input); 16 | var output = ''; 17 | for ( 18 | // initialize result and counter 19 | var block, charCode, idx = 0, map = chars; 20 | // if the next str index does not exist: 21 | // change the mapping table to "=" 22 | // check if d has no fractional digits 23 | str.charAt(idx | 0) || (map = '=', idx % 1); 24 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 25 | output += map.charAt(63 & block >> 8 - idx % 1 * 8) 26 | ) { 27 | charCode = str.charCodeAt(idx += 3 / 4); 28 | if (charCode > 0xFF) { 29 | throw new E(); 30 | } 31 | block = block << 8 | charCode; 32 | } 33 | return output; 34 | } 35 | 36 | module.exports = btoa; 37 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/buildURL.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | function encode(val) { 6 | return encodeURIComponent(val). 7 | replace(/%40/gi, '@'). 8 | replace(/%3A/gi, ':'). 9 | replace(/%24/g, '$'). 10 | replace(/%2C/gi, ','). 11 | replace(/%20/g, '+'). 12 | replace(/%5B/gi, '['). 13 | replace(/%5D/gi, ']'); 14 | } 15 | 16 | /** 17 | * Build a URL by appending params to the end 18 | * 19 | * @param {string} url The base of the url (e.g., http://www.google.com) 20 | * @param {object} [params] The params to be appended 21 | * @returns {string} The formatted url 22 | */ 23 | module.exports = function buildURL(url, params, paramsSerializer) { 24 | /*eslint no-param-reassign:0*/ 25 | if (!params) { 26 | return url; 27 | } 28 | 29 | var serializedParams; 30 | if (paramsSerializer) { 31 | serializedParams = paramsSerializer(params); 32 | } else if (utils.isURLSearchParams(params)) { 33 | serializedParams = params.toString(); 34 | } else { 35 | var parts = []; 36 | 37 | utils.forEach(params, function serialize(val, key) { 38 | if (val === null || typeof val === 'undefined') { 39 | return; 40 | } 41 | 42 | if (utils.isArray(val)) { 43 | key = key + '[]'; 44 | } else { 45 | val = [val]; 46 | } 47 | 48 | utils.forEach(val, function parseValue(v) { 49 | if (utils.isDate(v)) { 50 | v = v.toISOString(); 51 | } else if (utils.isObject(v)) { 52 | v = JSON.stringify(v); 53 | } 54 | parts.push(encode(key) + '=' + encode(v)); 55 | }); 56 | }); 57 | 58 | serializedParams = parts.join('&'); 59 | } 60 | 61 | if (serializedParams) { 62 | url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 63 | } 64 | 65 | return url; 66 | }; 67 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/combineURLs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Creates a new URL by combining the specified URLs 5 | * 6 | * @param {string} baseURL The base URL 7 | * @param {string} relativeURL The relative URL 8 | * @returns {string} The combined URL 9 | */ 10 | module.exports = function combineURLs(baseURL, relativeURL) { 11 | return relativeURL 12 | ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 13 | : baseURL; 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/cookies.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | module.exports = ( 6 | utils.isStandardBrowserEnv() ? 7 | 8 | // Standard browser envs support document.cookie 9 | (function standardBrowserEnv() { 10 | return { 11 | write: function write(name, value, expires, path, domain, secure) { 12 | var cookie = []; 13 | cookie.push(name + '=' + encodeURIComponent(value)); 14 | 15 | if (utils.isNumber(expires)) { 16 | cookie.push('expires=' + new Date(expires).toGMTString()); 17 | } 18 | 19 | if (utils.isString(path)) { 20 | cookie.push('path=' + path); 21 | } 22 | 23 | if (utils.isString(domain)) { 24 | cookie.push('domain=' + domain); 25 | } 26 | 27 | if (secure === true) { 28 | cookie.push('secure'); 29 | } 30 | 31 | document.cookie = cookie.join('; '); 32 | }, 33 | 34 | read: function read(name) { 35 | var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 36 | return (match ? decodeURIComponent(match[3]) : null); 37 | }, 38 | 39 | remove: function remove(name) { 40 | this.write(name, '', Date.now() - 86400000); 41 | } 42 | }; 43 | })() : 44 | 45 | // Non standard browser env (web workers, react-native) lack needed support. 46 | (function nonStandardBrowserEnv() { 47 | return { 48 | write: function write() {}, 49 | read: function read() { return null; }, 50 | remove: function remove() {} 51 | }; 52 | })() 53 | ); 54 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/deprecatedMethod.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*eslint no-console:0*/ 4 | 5 | /** 6 | * Supply a warning to the developer that a method they are using 7 | * has been deprecated. 8 | * 9 | * @param {string} method The name of the deprecated method 10 | * @param {string} [instead] The alternate method to use if applicable 11 | * @param {string} [docs] The documentation URL to get further details 12 | */ 13 | module.exports = function deprecatedMethod(method, instead, docs) { 14 | try { 15 | console.warn( 16 | 'DEPRECATED method `' + method + '`.' + 17 | (instead ? ' Use `' + instead + '` instead.' : '') + 18 | ' This method will be removed in a future release.'); 19 | 20 | if (docs) { 21 | console.warn('For more information about usage see ' + docs); 22 | } 23 | } catch (e) { /* Ignore */ } 24 | }; 25 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/isAbsoluteURL.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Determines whether the specified URL is absolute 5 | * 6 | * @param {string} url The URL to test 7 | * @returns {boolean} True if the specified URL is absolute, otherwise false 8 | */ 9 | module.exports = function isAbsoluteURL(url) { 10 | // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). 11 | // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 12 | // by any combination of letters, digits, plus, period, or hyphen. 13 | return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/isURLSameOrigin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | module.exports = ( 6 | utils.isStandardBrowserEnv() ? 7 | 8 | // Standard browser envs have full support of the APIs needed to test 9 | // whether the request URL is of the same origin as current location. 10 | (function standardBrowserEnv() { 11 | var msie = /(msie|trident)/i.test(navigator.userAgent); 12 | var urlParsingNode = document.createElement('a'); 13 | var originURL; 14 | 15 | /** 16 | * Parse a URL to discover it's components 17 | * 18 | * @param {String} url The URL to be parsed 19 | * @returns {Object} 20 | */ 21 | function resolveURL(url) { 22 | var href = url; 23 | 24 | if (msie) { 25 | // IE needs attribute set twice to normalize properties 26 | urlParsingNode.setAttribute('href', href); 27 | href = urlParsingNode.href; 28 | } 29 | 30 | urlParsingNode.setAttribute('href', href); 31 | 32 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 33 | return { 34 | href: urlParsingNode.href, 35 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 36 | host: urlParsingNode.host, 37 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 38 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 39 | hostname: urlParsingNode.hostname, 40 | port: urlParsingNode.port, 41 | pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 42 | urlParsingNode.pathname : 43 | '/' + urlParsingNode.pathname 44 | }; 45 | } 46 | 47 | originURL = resolveURL(window.location.href); 48 | 49 | /** 50 | * Determine if a URL shares the same origin as the current location 51 | * 52 | * @param {String} requestURL The URL to test 53 | * @returns {boolean} True if URL shares the same origin, otherwise false 54 | */ 55 | return function isURLSameOrigin(requestURL) { 56 | var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 57 | return (parsed.protocol === originURL.protocol && 58 | parsed.host === originURL.host); 59 | }; 60 | })() : 61 | 62 | // Non standard browser envs (web workers, react-native) lack needed support. 63 | (function nonStandardBrowserEnv() { 64 | return function isURLSameOrigin() { 65 | return true; 66 | }; 67 | })() 68 | ); 69 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/normalizeHeaderName.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils'); 4 | 5 | module.exports = function normalizeHeaderName(headers, normalizedName) { 6 | utils.forEach(headers, function processHeader(value, name) { 7 | if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 8 | headers[normalizedName] = value; 9 | delete headers[name]; 10 | } 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/parseHeaders.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./../utils'); 4 | 5 | // Headers whose duplicates are ignored by node 6 | // c.f. https://nodejs.org/api/http.html#http_message_headers 7 | var ignoreDuplicateOf = [ 8 | 'age', 'authorization', 'content-length', 'content-type', 'etag', 9 | 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 10 | 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 11 | 'referer', 'retry-after', 'user-agent' 12 | ]; 13 | 14 | /** 15 | * Parse headers into an object 16 | * 17 | * ``` 18 | * Date: Wed, 27 Aug 2014 08:58:49 GMT 19 | * Content-Type: application/json 20 | * Connection: keep-alive 21 | * Transfer-Encoding: chunked 22 | * ``` 23 | * 24 | * @param {String} headers Headers needing to be parsed 25 | * @returns {Object} Headers parsed into an object 26 | */ 27 | module.exports = function parseHeaders(headers) { 28 | var parsed = {}; 29 | var key; 30 | var val; 31 | var i; 32 | 33 | if (!headers) { return parsed; } 34 | 35 | utils.forEach(headers.split('\n'), function parser(line) { 36 | i = line.indexOf(':'); 37 | key = utils.trim(line.substr(0, i)).toLowerCase(); 38 | val = utils.trim(line.substr(i + 1)); 39 | 40 | if (key) { 41 | if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 42 | return; 43 | } 44 | if (key === 'set-cookie') { 45 | parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 46 | } else { 47 | parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 48 | } 49 | } 50 | }); 51 | 52 | return parsed; 53 | }; 54 | -------------------------------------------------------------------------------- /node_modules/axios/lib/helpers/spread.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Syntactic sugar for invoking a function and expanding an array for arguments. 5 | * 6 | * Common use case would be to use `Function.prototype.apply`. 7 | * 8 | * ```js 9 | * function f(x, y, z) {} 10 | * var args = [1, 2, 3]; 11 | * f.apply(null, args); 12 | * ``` 13 | * 14 | * With `spread` this example can be re-written. 15 | * 16 | * ```js 17 | * spread(function(x, y, z) {})([1, 2, 3]); 18 | * ``` 19 | * 20 | * @param {Function} callback 21 | * @returns {Function} 22 | */ 23 | module.exports = function spread(callback) { 24 | return function wrap(arr) { 25 | return callback.apply(null, arr); 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /node_modules/axios/lib/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var bind = require('./helpers/bind'); 4 | var isBuffer = require('is-buffer'); 5 | 6 | /*global toString:true*/ 7 | 8 | // utils is a library of generic helper functions non-specific to axios 9 | 10 | var toString = Object.prototype.toString; 11 | 12 | /** 13 | * Determine if a value is an Array 14 | * 15 | * @param {Object} val The value to test 16 | * @returns {boolean} True if value is an Array, otherwise false 17 | */ 18 | function isArray(val) { 19 | return toString.call(val) === '[object Array]'; 20 | } 21 | 22 | /** 23 | * Determine if a value is an ArrayBuffer 24 | * 25 | * @param {Object} val The value to test 26 | * @returns {boolean} True if value is an ArrayBuffer, otherwise false 27 | */ 28 | function isArrayBuffer(val) { 29 | return toString.call(val) === '[object ArrayBuffer]'; 30 | } 31 | 32 | /** 33 | * Determine if a value is a FormData 34 | * 35 | * @param {Object} val The value to test 36 | * @returns {boolean} True if value is an FormData, otherwise false 37 | */ 38 | function isFormData(val) { 39 | return (typeof FormData !== 'undefined') && (val instanceof FormData); 40 | } 41 | 42 | /** 43 | * Determine if a value is a view on an ArrayBuffer 44 | * 45 | * @param {Object} val The value to test 46 | * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 47 | */ 48 | function isArrayBufferView(val) { 49 | var result; 50 | if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 51 | result = ArrayBuffer.isView(val); 52 | } else { 53 | result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 54 | } 55 | return result; 56 | } 57 | 58 | /** 59 | * Determine if a value is a String 60 | * 61 | * @param {Object} val The value to test 62 | * @returns {boolean} True if value is a String, otherwise false 63 | */ 64 | function isString(val) { 65 | return typeof val === 'string'; 66 | } 67 | 68 | /** 69 | * Determine if a value is a Number 70 | * 71 | * @param {Object} val The value to test 72 | * @returns {boolean} True if value is a Number, otherwise false 73 | */ 74 | function isNumber(val) { 75 | return typeof val === 'number'; 76 | } 77 | 78 | /** 79 | * Determine if a value is undefined 80 | * 81 | * @param {Object} val The value to test 82 | * @returns {boolean} True if the value is undefined, otherwise false 83 | */ 84 | function isUndefined(val) { 85 | return typeof val === 'undefined'; 86 | } 87 | 88 | /** 89 | * Determine if a value is an Object 90 | * 91 | * @param {Object} val The value to test 92 | * @returns {boolean} True if value is an Object, otherwise false 93 | */ 94 | function isObject(val) { 95 | return val !== null && typeof val === 'object'; 96 | } 97 | 98 | /** 99 | * Determine if a value is a Date 100 | * 101 | * @param {Object} val The value to test 102 | * @returns {boolean} True if value is a Date, otherwise false 103 | */ 104 | function isDate(val) { 105 | return toString.call(val) === '[object Date]'; 106 | } 107 | 108 | /** 109 | * Determine if a value is a File 110 | * 111 | * @param {Object} val The value to test 112 | * @returns {boolean} True if value is a File, otherwise false 113 | */ 114 | function isFile(val) { 115 | return toString.call(val) === '[object File]'; 116 | } 117 | 118 | /** 119 | * Determine if a value is a Blob 120 | * 121 | * @param {Object} val The value to test 122 | * @returns {boolean} True if value is a Blob, otherwise false 123 | */ 124 | function isBlob(val) { 125 | return toString.call(val) === '[object Blob]'; 126 | } 127 | 128 | /** 129 | * Determine if a value is a Function 130 | * 131 | * @param {Object} val The value to test 132 | * @returns {boolean} True if value is a Function, otherwise false 133 | */ 134 | function isFunction(val) { 135 | return toString.call(val) === '[object Function]'; 136 | } 137 | 138 | /** 139 | * Determine if a value is a Stream 140 | * 141 | * @param {Object} val The value to test 142 | * @returns {boolean} True if value is a Stream, otherwise false 143 | */ 144 | function isStream(val) { 145 | return isObject(val) && isFunction(val.pipe); 146 | } 147 | 148 | /** 149 | * Determine if a value is a URLSearchParams object 150 | * 151 | * @param {Object} val The value to test 152 | * @returns {boolean} True if value is a URLSearchParams object, otherwise false 153 | */ 154 | function isURLSearchParams(val) { 155 | return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 156 | } 157 | 158 | /** 159 | * Trim excess whitespace off the beginning and end of a string 160 | * 161 | * @param {String} str The String to trim 162 | * @returns {String} The String freed of excess whitespace 163 | */ 164 | function trim(str) { 165 | return str.replace(/^\s*/, '').replace(/\s*$/, ''); 166 | } 167 | 168 | /** 169 | * Determine if we're running in a standard browser environment 170 | * 171 | * This allows axios to run in a web worker, and react-native. 172 | * Both environments support XMLHttpRequest, but not fully standard globals. 173 | * 174 | * web workers: 175 | * typeof window -> undefined 176 | * typeof document -> undefined 177 | * 178 | * react-native: 179 | * navigator.product -> 'ReactNative' 180 | */ 181 | function isStandardBrowserEnv() { 182 | if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { 183 | return false; 184 | } 185 | return ( 186 | typeof window !== 'undefined' && 187 | typeof document !== 'undefined' 188 | ); 189 | } 190 | 191 | /** 192 | * Iterate over an Array or an Object invoking a function for each item. 193 | * 194 | * If `obj` is an Array callback will be called passing 195 | * the value, index, and complete array for each item. 196 | * 197 | * If 'obj' is an Object callback will be called passing 198 | * the value, key, and complete object for each property. 199 | * 200 | * @param {Object|Array} obj The object to iterate 201 | * @param {Function} fn The callback to invoke for each item 202 | */ 203 | function forEach(obj, fn) { 204 | // Don't bother if no value provided 205 | if (obj === null || typeof obj === 'undefined') { 206 | return; 207 | } 208 | 209 | // Force an array if not already something iterable 210 | if (typeof obj !== 'object') { 211 | /*eslint no-param-reassign:0*/ 212 | obj = [obj]; 213 | } 214 | 215 | if (isArray(obj)) { 216 | // Iterate over array values 217 | for (var i = 0, l = obj.length; i < l; i++) { 218 | fn.call(null, obj[i], i, obj); 219 | } 220 | } else { 221 | // Iterate over object keys 222 | for (var key in obj) { 223 | if (Object.prototype.hasOwnProperty.call(obj, key)) { 224 | fn.call(null, obj[key], key, obj); 225 | } 226 | } 227 | } 228 | } 229 | 230 | /** 231 | * Accepts varargs expecting each argument to be an object, then 232 | * immutably merges the properties of each object and returns result. 233 | * 234 | * When multiple objects contain the same key the later object in 235 | * the arguments list will take precedence. 236 | * 237 | * Example: 238 | * 239 | * ```js 240 | * var result = merge({foo: 123}, {foo: 456}); 241 | * console.log(result.foo); // outputs 456 242 | * ``` 243 | * 244 | * @param {Object} obj1 Object to merge 245 | * @returns {Object} Result of all merge properties 246 | */ 247 | function merge(/* obj1, obj2, obj3, ... */) { 248 | var result = {}; 249 | function assignValue(val, key) { 250 | if (typeof result[key] === 'object' && typeof val === 'object') { 251 | result[key] = merge(result[key], val); 252 | } else { 253 | result[key] = val; 254 | } 255 | } 256 | 257 | for (var i = 0, l = arguments.length; i < l; i++) { 258 | forEach(arguments[i], assignValue); 259 | } 260 | return result; 261 | } 262 | 263 | /** 264 | * Extends object a by mutably adding to it the properties of object b. 265 | * 266 | * @param {Object} a The object to be extended 267 | * @param {Object} b The object to copy properties from 268 | * @param {Object} thisArg The object to bind function to 269 | * @return {Object} The resulting value of object a 270 | */ 271 | function extend(a, b, thisArg) { 272 | forEach(b, function assignValue(val, key) { 273 | if (thisArg && typeof val === 'function') { 274 | a[key] = bind(val, thisArg); 275 | } else { 276 | a[key] = val; 277 | } 278 | }); 279 | return a; 280 | } 281 | 282 | module.exports = { 283 | isArray: isArray, 284 | isArrayBuffer: isArrayBuffer, 285 | isBuffer: isBuffer, 286 | isFormData: isFormData, 287 | isArrayBufferView: isArrayBufferView, 288 | isString: isString, 289 | isNumber: isNumber, 290 | isObject: isObject, 291 | isUndefined: isUndefined, 292 | isDate: isDate, 293 | isFile: isFile, 294 | isBlob: isBlob, 295 | isFunction: isFunction, 296 | isStream: isStream, 297 | isURLSearchParams: isURLSearchParams, 298 | isStandardBrowserEnv: isStandardBrowserEnv, 299 | forEach: forEach, 300 | merge: merge, 301 | extend: extend, 302 | trim: trim 303 | }; 304 | -------------------------------------------------------------------------------- /node_modules/axios/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "axios", 3 | "_id": "axios@0.18.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", 6 | "_location": "/axios", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "axios", 12 | "name": "axios", 13 | "escapedName": "axios", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", 23 | "_shasum": "32d53e4851efdc0a11993b6cd000789d70c05102", 24 | "_spec": "axios", 25 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\MerlinBot", 26 | "author": { 27 | "name": "Matt Zabriskie" 28 | }, 29 | "browser": { 30 | "./lib/adapters/http.js": "./lib/adapters/xhr.js" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/axios/axios/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "bundlesize": [ 37 | { 38 | "path": "./dist/axios.min.js", 39 | "threshold": "5kB" 40 | } 41 | ], 42 | "dependencies": { 43 | "follow-redirects": "^1.3.0", 44 | "is-buffer": "^1.1.5" 45 | }, 46 | "deprecated": false, 47 | "description": "Promise based HTTP client for the browser and node.js", 48 | "devDependencies": { 49 | "bundlesize": "^0.5.7", 50 | "coveralls": "^2.11.9", 51 | "es6-promise": "^4.0.5", 52 | "grunt": "^1.0.1", 53 | "grunt-banner": "^0.6.0", 54 | "grunt-cli": "^1.2.0", 55 | "grunt-contrib-clean": "^1.0.0", 56 | "grunt-contrib-nodeunit": "^1.0.0", 57 | "grunt-contrib-watch": "^1.0.0", 58 | "grunt-eslint": "^19.0.0", 59 | "grunt-karma": "^2.0.0", 60 | "grunt-ts": "^6.0.0-beta.3", 61 | "grunt-webpack": "^1.0.18", 62 | "istanbul-instrumenter-loader": "^1.0.0", 63 | "jasmine-core": "^2.4.1", 64 | "karma": "^1.3.0", 65 | "karma-chrome-launcher": "^2.0.0", 66 | "karma-coverage": "^1.0.0", 67 | "karma-firefox-launcher": "^1.0.0", 68 | "karma-jasmine": "^1.0.2", 69 | "karma-jasmine-ajax": "^0.1.13", 70 | "karma-opera-launcher": "^1.0.0", 71 | "karma-safari-launcher": "^1.0.0", 72 | "karma-sauce-launcher": "^1.1.0", 73 | "karma-sinon": "^1.0.5", 74 | "karma-sourcemap-loader": "^0.3.7", 75 | "karma-webpack": "^1.7.0", 76 | "load-grunt-tasks": "^3.5.2", 77 | "minimist": "^1.2.0", 78 | "sinon": "^1.17.4", 79 | "typescript": "^2.0.3", 80 | "url-search-params": "^0.6.1", 81 | "webpack": "^1.13.1", 82 | "webpack-dev-server": "^1.14.1" 83 | }, 84 | "homepage": "https://github.com/axios/axios", 85 | "keywords": [ 86 | "xhr", 87 | "http", 88 | "ajax", 89 | "promise", 90 | "node" 91 | ], 92 | "license": "MIT", 93 | "main": "index.js", 94 | "name": "axios", 95 | "repository": { 96 | "type": "git", 97 | "url": "git+https://github.com/axios/axios.git" 98 | }, 99 | "scripts": { 100 | "build": "NODE_ENV=production grunt build", 101 | "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 102 | "examples": "node ./examples/server.js", 103 | "postversion": "git push && git push --tags", 104 | "preversion": "npm test", 105 | "start": "node ./sandbox/server.js", 106 | "test": "grunt test && bundlesize", 107 | "version": "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json" 108 | }, 109 | "typings": "./index.d.ts", 110 | "version": "0.18.0" 111 | } 112 | -------------------------------------------------------------------------------- /node_modules/debug/.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve 2 | -------------------------------------------------------------------------------- /node_modules/debug/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "globals": { 7 | "chrome": true 8 | }, 9 | "rules": { 10 | "no-console": 0, 11 | "no-empty": [1, { "allowEmptyCatch": true }] 12 | }, 13 | "extends": "eslint:recommended" 14 | } 15 | -------------------------------------------------------------------------------- /node_modules/debug/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | example 5 | *.sock 6 | dist 7 | yarn.lock 8 | coverage 9 | bower.json 10 | -------------------------------------------------------------------------------- /node_modules/debug/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "4" 7 | - "6" 8 | - "8" 9 | 10 | install: 11 | - make install 12 | 13 | script: 14 | - make lint 15 | - make test 16 | 17 | matrix: 18 | include: 19 | - node_js: '8' 20 | env: BROWSER=1 21 | -------------------------------------------------------------------------------- /node_modules/debug/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3.1.0 / 2017-09-26 3 | ================== 4 | 5 | * Add `DEBUG_HIDE_DATE` env var (#486) 6 | * Remove ReDoS regexp in %o formatter (#504) 7 | * Remove "component" from package.json 8 | * Remove `component.json` 9 | * Ignore package-lock.json 10 | * Examples: fix colors printout 11 | * Fix: browser detection 12 | * Fix: spelling mistake (#496, @EdwardBetts) 13 | 14 | 3.0.1 / 2017-08-24 15 | ================== 16 | 17 | * Fix: Disable colors in Edge and Internet Explorer (#489) 18 | 19 | 3.0.0 / 2017-08-08 20 | ================== 21 | 22 | * Breaking: Remove DEBUG_FD (#406) 23 | * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) 24 | * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) 25 | * Addition: document `enabled` flag (#465) 26 | * Addition: add 256 colors mode (#481) 27 | * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) 28 | * Update: component: update "ms" to v2.0.0 29 | * Update: separate the Node and Browser tests in Travis-CI 30 | * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots 31 | * Update: separate Node.js and web browser examples for organization 32 | * Update: update "browserify" to v14.4.0 33 | * Fix: fix Readme typo (#473) 34 | 35 | 2.6.9 / 2017-09-22 36 | ================== 37 | 38 | * remove ReDoS regexp in %o formatter (#504) 39 | 40 | 2.6.8 / 2017-05-18 41 | ================== 42 | 43 | * Fix: Check for undefined on browser globals (#462, @marbemac) 44 | 45 | 2.6.7 / 2017-05-16 46 | ================== 47 | 48 | * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) 49 | * Fix: Inline extend function in node implementation (#452, @dougwilson) 50 | * Docs: Fix typo (#455, @msasad) 51 | 52 | 2.6.5 / 2017-04-27 53 | ================== 54 | 55 | * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) 56 | * Misc: clean up browser reference checks (#447, @thebigredgeek) 57 | * Misc: add npm-debug.log to .gitignore (@thebigredgeek) 58 | 59 | 60 | 2.6.4 / 2017-04-20 61 | ================== 62 | 63 | * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) 64 | * Chore: ignore bower.json in npm installations. (#437, @joaovieira) 65 | * Misc: update "ms" to v0.7.3 (@tootallnate) 66 | 67 | 2.6.3 / 2017-03-13 68 | ================== 69 | 70 | * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) 71 | * Docs: Changelog fix (@thebigredgeek) 72 | 73 | 2.6.2 / 2017-03-10 74 | ================== 75 | 76 | * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) 77 | * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) 78 | * Docs: Add Slackin invite badge (@tootallnate) 79 | 80 | 2.6.1 / 2017-02-10 81 | ================== 82 | 83 | * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error 84 | * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) 85 | * Fix: IE8 "Expected identifier" error (#414, @vgoma) 86 | * Fix: Namespaces would not disable once enabled (#409, @musikov) 87 | 88 | 2.6.0 / 2016-12-28 89 | ================== 90 | 91 | * Fix: added better null pointer checks for browser useColors (@thebigredgeek) 92 | * Improvement: removed explicit `window.debug` export (#404, @tootallnate) 93 | * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) 94 | 95 | 2.5.2 / 2016-12-25 96 | ================== 97 | 98 | * Fix: reference error on window within webworkers (#393, @KlausTrainer) 99 | * Docs: fixed README typo (#391, @lurch) 100 | * Docs: added notice about v3 api discussion (@thebigredgeek) 101 | 102 | 2.5.1 / 2016-12-20 103 | ================== 104 | 105 | * Fix: babel-core compatibility 106 | 107 | 2.5.0 / 2016-12-20 108 | ================== 109 | 110 | * Fix: wrong reference in bower file (@thebigredgeek) 111 | * Fix: webworker compatibility (@thebigredgeek) 112 | * Fix: output formatting issue (#388, @kribblo) 113 | * Fix: babel-loader compatibility (#383, @escwald) 114 | * Misc: removed built asset from repo and publications (@thebigredgeek) 115 | * Misc: moved source files to /src (#378, @yamikuronue) 116 | * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) 117 | * Test: coveralls integration (#378, @yamikuronue) 118 | * Docs: simplified language in the opening paragraph (#373, @yamikuronue) 119 | 120 | 2.4.5 / 2016-12-17 121 | ================== 122 | 123 | * Fix: `navigator` undefined in Rhino (#376, @jochenberger) 124 | * Fix: custom log function (#379, @hsiliev) 125 | * Improvement: bit of cleanup + linting fixes (@thebigredgeek) 126 | * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) 127 | * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) 128 | 129 | 2.4.4 / 2016-12-14 130 | ================== 131 | 132 | * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) 133 | 134 | 2.4.3 / 2016-12-14 135 | ================== 136 | 137 | * Fix: navigation.userAgent error for react native (#364, @escwald) 138 | 139 | 2.4.2 / 2016-12-14 140 | ================== 141 | 142 | * Fix: browser colors (#367, @tootallnate) 143 | * Misc: travis ci integration (@thebigredgeek) 144 | * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) 145 | 146 | 2.4.1 / 2016-12-13 147 | ================== 148 | 149 | * Fix: typo that broke the package (#356) 150 | 151 | 2.4.0 / 2016-12-13 152 | ================== 153 | 154 | * Fix: bower.json references unbuilt src entry point (#342, @justmatt) 155 | * Fix: revert "handle regex special characters" (@tootallnate) 156 | * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) 157 | * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) 158 | * Improvement: allow colors in workers (#335, @botverse) 159 | * Improvement: use same color for same namespace. (#338, @lchenay) 160 | 161 | 2.3.3 / 2016-11-09 162 | ================== 163 | 164 | * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) 165 | * Fix: Returning `localStorage` saved values (#331, Levi Thomason) 166 | * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) 167 | 168 | 2.3.2 / 2016-11-09 169 | ================== 170 | 171 | * Fix: be super-safe in index.js as well (@TooTallNate) 172 | * Fix: should check whether process exists (Tom Newby) 173 | 174 | 2.3.1 / 2016-11-09 175 | ================== 176 | 177 | * Fix: Added electron compatibility (#324, @paulcbetts) 178 | * Improvement: Added performance optimizations (@tootallnate) 179 | * Readme: Corrected PowerShell environment variable example (#252, @gimre) 180 | * Misc: Removed yarn lock file from source control (#321, @fengmk2) 181 | 182 | 2.3.0 / 2016-11-07 183 | ================== 184 | 185 | * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) 186 | * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) 187 | * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) 188 | * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) 189 | * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) 190 | * Package: Update "ms" to 0.7.2 (#315, @DevSide) 191 | * Package: removed superfluous version property from bower.json (#207 @kkirsche) 192 | * Readme: fix USE_COLORS to DEBUG_COLORS 193 | * Readme: Doc fixes for format string sugar (#269, @mlucool) 194 | * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) 195 | * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) 196 | * Readme: better docs for browser support (#224, @matthewmueller) 197 | * Tooling: Added yarn integration for development (#317, @thebigredgeek) 198 | * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) 199 | * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) 200 | * Misc: Updated contributors (@thebigredgeek) 201 | 202 | 2.2.0 / 2015-05-09 203 | ================== 204 | 205 | * package: update "ms" to v0.7.1 (#202, @dougwilson) 206 | * README: add logging to file example (#193, @DanielOchoa) 207 | * README: fixed a typo (#191, @amir-s) 208 | * browser: expose `storage` (#190, @stephenmathieson) 209 | * Makefile: add a `distclean` target (#189, @stephenmathieson) 210 | 211 | 2.1.3 / 2015-03-13 212 | ================== 213 | 214 | * Updated stdout/stderr example (#186) 215 | * Updated example/stdout.js to match debug current behaviour 216 | * Renamed example/stderr.js to stdout.js 217 | * Update Readme.md (#184) 218 | * replace high intensity foreground color for bold (#182, #183) 219 | 220 | 2.1.2 / 2015-03-01 221 | ================== 222 | 223 | * dist: recompile 224 | * update "ms" to v0.7.0 225 | * package: update "browserify" to v9.0.3 226 | * component: fix "ms.js" repo location 227 | * changed bower package name 228 | * updated documentation about using debug in a browser 229 | * fix: security error on safari (#167, #168, @yields) 230 | 231 | 2.1.1 / 2014-12-29 232 | ================== 233 | 234 | * browser: use `typeof` to check for `console` existence 235 | * browser: check for `console.log` truthiness (fix IE 8/9) 236 | * browser: add support for Chrome apps 237 | * Readme: added Windows usage remarks 238 | * Add `bower.json` to properly support bower install 239 | 240 | 2.1.0 / 2014-10-15 241 | ================== 242 | 243 | * node: implement `DEBUG_FD` env variable support 244 | * package: update "browserify" to v6.1.0 245 | * package: add "license" field to package.json (#135, @panuhorsmalahti) 246 | 247 | 2.0.0 / 2014-09-01 248 | ================== 249 | 250 | * package: update "browserify" to v5.11.0 251 | * node: use stderr rather than stdout for logging (#29, @stephenmathieson) 252 | 253 | 1.0.4 / 2014-07-15 254 | ================== 255 | 256 | * dist: recompile 257 | * example: remove `console.info()` log usage 258 | * example: add "Content-Type" UTF-8 header to browser example 259 | * browser: place %c marker after the space character 260 | * browser: reset the "content" color via `color: inherit` 261 | * browser: add colors support for Firefox >= v31 262 | * debug: prefer an instance `log()` function over the global one (#119) 263 | * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) 264 | 265 | 1.0.3 / 2014-07-09 266 | ================== 267 | 268 | * Add support for multiple wildcards in namespaces (#122, @seegno) 269 | * browser: fix lint 270 | 271 | 1.0.2 / 2014-06-10 272 | ================== 273 | 274 | * browser: update color palette (#113, @gscottolson) 275 | * common: make console logging function configurable (#108, @timoxley) 276 | * node: fix %o colors on old node <= 0.8.x 277 | * Makefile: find node path using shell/which (#109, @timoxley) 278 | 279 | 1.0.1 / 2014-06-06 280 | ================== 281 | 282 | * browser: use `removeItem()` to clear localStorage 283 | * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) 284 | * package: add "contributors" section 285 | * node: fix comment typo 286 | * README: list authors 287 | 288 | 1.0.0 / 2014-06-04 289 | ================== 290 | 291 | * make ms diff be global, not be scope 292 | * debug: ignore empty strings in enable() 293 | * node: make DEBUG_COLORS able to disable coloring 294 | * *: export the `colors` array 295 | * npmignore: don't publish the `dist` dir 296 | * Makefile: refactor to use browserify 297 | * package: add "browserify" as a dev dependency 298 | * Readme: add Web Inspector Colors section 299 | * node: reset terminal color for the debug content 300 | * node: map "%o" to `util.inspect()` 301 | * browser: map "%j" to `JSON.stringify()` 302 | * debug: add custom "formatters" 303 | * debug: use "ms" module for humanizing the diff 304 | * Readme: add "bash" syntax highlighting 305 | * browser: add Firebug color support 306 | * browser: add colors for WebKit browsers 307 | * node: apply log to `console` 308 | * rewrite: abstract common logic for Node & browsers 309 | * add .jshintrc file 310 | 311 | 0.8.1 / 2014-04-14 312 | ================== 313 | 314 | * package: re-add the "component" section 315 | 316 | 0.8.0 / 2014-03-30 317 | ================== 318 | 319 | * add `enable()` method for nodejs. Closes #27 320 | * change from stderr to stdout 321 | * remove unnecessary index.js file 322 | 323 | 0.7.4 / 2013-11-13 324 | ================== 325 | 326 | * remove "browserify" key from package.json (fixes something in browserify) 327 | 328 | 0.7.3 / 2013-10-30 329 | ================== 330 | 331 | * fix: catch localStorage security error when cookies are blocked (Chrome) 332 | * add debug(err) support. Closes #46 333 | * add .browser prop to package.json. Closes #42 334 | 335 | 0.7.2 / 2013-02-06 336 | ================== 337 | 338 | * fix package.json 339 | * fix: Mobile Safari (private mode) is broken with debug 340 | * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript 341 | 342 | 0.7.1 / 2013-02-05 343 | ================== 344 | 345 | * add repository URL to package.json 346 | * add DEBUG_COLORED to force colored output 347 | * add browserify support 348 | * fix component. Closes #24 349 | 350 | 0.7.0 / 2012-05-04 351 | ================== 352 | 353 | * Added .component to package.json 354 | * Added debug.component.js build 355 | 356 | 0.6.0 / 2012-03-16 357 | ================== 358 | 359 | * Added support for "-" prefix in DEBUG [Vinay Pulim] 360 | * Added `.enabled` flag to the node version [TooTallNate] 361 | 362 | 0.5.0 / 2012-02-02 363 | ================== 364 | 365 | * Added: humanize diffs. Closes #8 366 | * Added `debug.disable()` to the CS variant 367 | * Removed padding. Closes #10 368 | * Fixed: persist client-side variant again. Closes #9 369 | 370 | 0.4.0 / 2012-02-01 371 | ================== 372 | 373 | * Added browser variant support for older browsers [TooTallNate] 374 | * Added `debug.enable('project:*')` to browser variant [TooTallNate] 375 | * Added padding to diff (moved it to the right) 376 | 377 | 0.3.0 / 2012-01-26 378 | ================== 379 | 380 | * Added millisecond diff when isatty, otherwise UTC string 381 | 382 | 0.2.0 / 2012-01-22 383 | ================== 384 | 385 | * Added wildcard support 386 | 387 | 0.1.0 / 2011-12-02 388 | ================== 389 | 390 | * Added: remove colors unless stderr isatty [TooTallNate] 391 | 392 | 0.0.1 / 2010-01-03 393 | ================== 394 | 395 | * Initial release 396 | -------------------------------------------------------------------------------- /node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial 12 | portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /node_modules/debug/Makefile: -------------------------------------------------------------------------------- 1 | # get Makefile directory name: http://stackoverflow.com/a/5982798/376773 2 | THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 3 | THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) 4 | 5 | # BIN directory 6 | BIN := $(THIS_DIR)/node_modules/.bin 7 | 8 | # Path 9 | PATH := node_modules/.bin:$(PATH) 10 | SHELL := /bin/bash 11 | 12 | # applications 13 | NODE ?= $(shell which node) 14 | YARN ?= $(shell which yarn) 15 | PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) 16 | BROWSERIFY ?= $(NODE) $(BIN)/browserify 17 | 18 | install: node_modules 19 | 20 | browser: dist/debug.js 21 | 22 | node_modules: package.json 23 | @NODE_ENV= $(PKG) install 24 | @touch node_modules 25 | 26 | dist/debug.js: src/*.js node_modules 27 | @mkdir -p dist 28 | @$(BROWSERIFY) \ 29 | --standalone debug \ 30 | . > dist/debug.js 31 | 32 | lint: 33 | @eslint *.js src/*.js 34 | 35 | test-node: 36 | @istanbul cover node_modules/mocha/bin/_mocha -- test/**.js 37 | @cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 38 | 39 | test-browser: 40 | @$(MAKE) browser 41 | @karma start --single-run 42 | 43 | test-all: 44 | @concurrently \ 45 | "make test-node" \ 46 | "make test-browser" 47 | 48 | test: 49 | @if [ "x$(BROWSER)" = "x" ]; then \ 50 | $(MAKE) test-node; \ 51 | else \ 52 | $(MAKE) test-browser; \ 53 | fi 54 | 55 | clean: 56 | rimraf dist coverage 57 | 58 | .PHONY: browser install clean lint test test-all test-node test-browser 59 | -------------------------------------------------------------------------------- /node_modules/debug/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | 7 | // base path that will be used to resolve all patterns (eg. files, exclude) 8 | basePath: '', 9 | 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['mocha', 'chai', 'sinon'], 14 | 15 | 16 | // list of files / patterns to load in the browser 17 | files: [ 18 | 'dist/debug.js', 19 | 'test/*spec.js' 20 | ], 21 | 22 | 23 | // list of files to exclude 24 | exclude: [ 25 | 'src/node.js' 26 | ], 27 | 28 | 29 | // preprocess matching files before serving them to the browser 30 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 31 | preprocessors: { 32 | }, 33 | 34 | // test results reporter to use 35 | // possible values: 'dots', 'progress' 36 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 37 | reporters: ['progress'], 38 | 39 | 40 | // web server port 41 | port: 9876, 42 | 43 | 44 | // enable / disable colors in the output (reporters and logs) 45 | colors: true, 46 | 47 | 48 | // level of logging 49 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 50 | logLevel: config.LOG_INFO, 51 | 52 | 53 | // enable / disable watching file and executing tests whenever any file changes 54 | autoWatch: true, 55 | 56 | 57 | // start these browsers 58 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 59 | browsers: ['PhantomJS'], 60 | 61 | 62 | // Continuous Integration mode 63 | // if true, Karma captures browsers, runs the tests and exits 64 | singleRun: false, 65 | 66 | // Concurrency level 67 | // how many browser should be started simultaneous 68 | concurrency: Infinity 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/debug/node.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./src/node'); 2 | -------------------------------------------------------------------------------- /node_modules/debug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "debug@^3.1.0", 3 | "_id": "debug@3.1.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 6 | "_location": "/debug", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "debug@^3.1.0", 12 | "name": "debug", 13 | "escapedName": "debug", 14 | "rawSpec": "^3.1.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^3.1.0" 17 | }, 18 | "_requiredBy": [ 19 | "/follow-redirects" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 22 | "_shasum": "5bb5a0672628b64149566ba16819e61518c67261", 23 | "_spec": "debug@^3.1.0", 24 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\MerlinBot\\node_modules\\follow-redirects", 25 | "author": { 26 | "name": "TJ Holowaychuk", 27 | "email": "tj@vision-media.ca" 28 | }, 29 | "browser": "./src/browser.js", 30 | "bugs": { 31 | "url": "https://github.com/visionmedia/debug/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "contributors": [ 35 | { 36 | "name": "Nathan Rajlich", 37 | "email": "nathan@tootallnate.net", 38 | "url": "http://n8.io" 39 | }, 40 | { 41 | "name": "Andrew Rhyne", 42 | "email": "rhyneandrew@gmail.com" 43 | } 44 | ], 45 | "dependencies": { 46 | "ms": "2.0.0" 47 | }, 48 | "deprecated": false, 49 | "description": "small debugging utility", 50 | "devDependencies": { 51 | "browserify": "14.4.0", 52 | "chai": "^3.5.0", 53 | "concurrently": "^3.1.0", 54 | "coveralls": "^2.11.15", 55 | "eslint": "^3.12.1", 56 | "istanbul": "^0.4.5", 57 | "karma": "^1.3.0", 58 | "karma-chai": "^0.1.0", 59 | "karma-mocha": "^1.3.0", 60 | "karma-phantomjs-launcher": "^1.0.2", 61 | "karma-sinon": "^1.0.5", 62 | "mocha": "^3.2.0", 63 | "mocha-lcov-reporter": "^1.2.0", 64 | "rimraf": "^2.5.4", 65 | "sinon": "^1.17.6", 66 | "sinon-chai": "^2.8.0" 67 | }, 68 | "homepage": "https://github.com/visionmedia/debug#readme", 69 | "keywords": [ 70 | "debug", 71 | "log", 72 | "debugger" 73 | ], 74 | "license": "MIT", 75 | "main": "./src/index.js", 76 | "name": "debug", 77 | "repository": { 78 | "type": "git", 79 | "url": "git://github.com/visionmedia/debug.git" 80 | }, 81 | "version": "3.1.0" 82 | } 83 | -------------------------------------------------------------------------------- /node_modules/debug/src/browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is the web browser implementation of `debug()`. 3 | * 4 | * Expose `debug()` as the module. 5 | */ 6 | 7 | exports = module.exports = require('./debug'); 8 | exports.log = log; 9 | exports.formatArgs = formatArgs; 10 | exports.save = save; 11 | exports.load = load; 12 | exports.useColors = useColors; 13 | exports.storage = 'undefined' != typeof chrome 14 | && 'undefined' != typeof chrome.storage 15 | ? chrome.storage.local 16 | : localstorage(); 17 | 18 | /** 19 | * Colors. 20 | */ 21 | 22 | exports.colors = [ 23 | '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', 24 | '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', 25 | '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', 26 | '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', 27 | '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', 28 | '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', 29 | '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', 30 | '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', 31 | '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', 32 | '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', 33 | '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' 34 | ]; 35 | 36 | /** 37 | * Currently only WebKit-based Web Inspectors, Firefox >= v31, 38 | * and the Firebug extension (any Firefox version) are known 39 | * to support "%c" CSS customizations. 40 | * 41 | * TODO: add a `localStorage` variable to explicitly enable/disable colors 42 | */ 43 | 44 | function useColors() { 45 | // NB: In an Electron preload script, document will be defined but not fully 46 | // initialized. Since we know we're in Chrome, we'll just detect this case 47 | // explicitly 48 | if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { 49 | return true; 50 | } 51 | 52 | // Internet Explorer and Edge do not support colors. 53 | if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { 54 | return false; 55 | } 56 | 57 | // is webkit? http://stackoverflow.com/a/16459606/376773 58 | // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 59 | return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || 60 | // is firebug? http://stackoverflow.com/a/398120/376773 61 | (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || 62 | // is firefox >= v31? 63 | // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages 64 | (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || 65 | // double check webkit in userAgent just in case we are in a worker 66 | (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); 67 | } 68 | 69 | /** 70 | * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. 71 | */ 72 | 73 | exports.formatters.j = function(v) { 74 | try { 75 | return JSON.stringify(v); 76 | } catch (err) { 77 | return '[UnexpectedJSONParseError]: ' + err.message; 78 | } 79 | }; 80 | 81 | 82 | /** 83 | * Colorize log arguments if enabled. 84 | * 85 | * @api public 86 | */ 87 | 88 | function formatArgs(args) { 89 | var useColors = this.useColors; 90 | 91 | args[0] = (useColors ? '%c' : '') 92 | + this.namespace 93 | + (useColors ? ' %c' : ' ') 94 | + args[0] 95 | + (useColors ? '%c ' : ' ') 96 | + '+' + exports.humanize(this.diff); 97 | 98 | if (!useColors) return; 99 | 100 | var c = 'color: ' + this.color; 101 | args.splice(1, 0, c, 'color: inherit') 102 | 103 | // the final "%c" is somewhat tricky, because there could be other 104 | // arguments passed either before or after the %c, so we need to 105 | // figure out the correct index to insert the CSS into 106 | var index = 0; 107 | var lastC = 0; 108 | args[0].replace(/%[a-zA-Z%]/g, function(match) { 109 | if ('%%' === match) return; 110 | index++; 111 | if ('%c' === match) { 112 | // we only are interested in the *last* %c 113 | // (the user may have provided their own) 114 | lastC = index; 115 | } 116 | }); 117 | 118 | args.splice(lastC, 0, c); 119 | } 120 | 121 | /** 122 | * Invokes `console.log()` when available. 123 | * No-op when `console.log` is not a "function". 124 | * 125 | * @api public 126 | */ 127 | 128 | function log() { 129 | // this hackery is required for IE8/9, where 130 | // the `console.log` function doesn't have 'apply' 131 | return 'object' === typeof console 132 | && console.log 133 | && Function.prototype.apply.call(console.log, console, arguments); 134 | } 135 | 136 | /** 137 | * Save `namespaces`. 138 | * 139 | * @param {String} namespaces 140 | * @api private 141 | */ 142 | 143 | function save(namespaces) { 144 | try { 145 | if (null == namespaces) { 146 | exports.storage.removeItem('debug'); 147 | } else { 148 | exports.storage.debug = namespaces; 149 | } 150 | } catch(e) {} 151 | } 152 | 153 | /** 154 | * Load `namespaces`. 155 | * 156 | * @return {String} returns the previously persisted debug modes 157 | * @api private 158 | */ 159 | 160 | function load() { 161 | var r; 162 | try { 163 | r = exports.storage.debug; 164 | } catch(e) {} 165 | 166 | // If debug isn't set in LS, and we're in Electron, try to load $DEBUG 167 | if (!r && typeof process !== 'undefined' && 'env' in process) { 168 | r = process.env.DEBUG; 169 | } 170 | 171 | return r; 172 | } 173 | 174 | /** 175 | * Enable namespaces listed in `localStorage.debug` initially. 176 | */ 177 | 178 | exports.enable(load()); 179 | 180 | /** 181 | * Localstorage attempts to return the localstorage. 182 | * 183 | * This is necessary because safari throws 184 | * when a user disables cookies/localstorage 185 | * and you attempt to access it. 186 | * 187 | * @return {LocalStorage} 188 | * @api private 189 | */ 190 | 191 | function localstorage() { 192 | try { 193 | return window.localStorage; 194 | } catch (e) {} 195 | } 196 | -------------------------------------------------------------------------------- /node_modules/debug/src/debug.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * This is the common logic for both the Node.js and web browser 4 | * implementations of `debug()`. 5 | * 6 | * Expose `debug()` as the module. 7 | */ 8 | 9 | exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; 10 | exports.coerce = coerce; 11 | exports.disable = disable; 12 | exports.enable = enable; 13 | exports.enabled = enabled; 14 | exports.humanize = require('ms'); 15 | 16 | /** 17 | * Active `debug` instances. 18 | */ 19 | exports.instances = []; 20 | 21 | /** 22 | * The currently active debug mode names, and names to skip. 23 | */ 24 | 25 | exports.names = []; 26 | exports.skips = []; 27 | 28 | /** 29 | * Map of special "%n" handling functions, for the debug "format" argument. 30 | * 31 | * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". 32 | */ 33 | 34 | exports.formatters = {}; 35 | 36 | /** 37 | * Select a color. 38 | * @param {String} namespace 39 | * @return {Number} 40 | * @api private 41 | */ 42 | 43 | function selectColor(namespace) { 44 | var hash = 0, i; 45 | 46 | for (i in namespace) { 47 | hash = ((hash << 5) - hash) + namespace.charCodeAt(i); 48 | hash |= 0; // Convert to 32bit integer 49 | } 50 | 51 | return exports.colors[Math.abs(hash) % exports.colors.length]; 52 | } 53 | 54 | /** 55 | * Create a debugger with the given `namespace`. 56 | * 57 | * @param {String} namespace 58 | * @return {Function} 59 | * @api public 60 | */ 61 | 62 | function createDebug(namespace) { 63 | 64 | var prevTime; 65 | 66 | function debug() { 67 | // disabled? 68 | if (!debug.enabled) return; 69 | 70 | var self = debug; 71 | 72 | // set `diff` timestamp 73 | var curr = +new Date(); 74 | var ms = curr - (prevTime || curr); 75 | self.diff = ms; 76 | self.prev = prevTime; 77 | self.curr = curr; 78 | prevTime = curr; 79 | 80 | // turn the `arguments` into a proper Array 81 | var args = new Array(arguments.length); 82 | for (var i = 0; i < args.length; i++) { 83 | args[i] = arguments[i]; 84 | } 85 | 86 | args[0] = exports.coerce(args[0]); 87 | 88 | if ('string' !== typeof args[0]) { 89 | // anything else let's inspect with %O 90 | args.unshift('%O'); 91 | } 92 | 93 | // apply any `formatters` transformations 94 | var index = 0; 95 | args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { 96 | // if we encounter an escaped % then don't increase the array index 97 | if (match === '%%') return match; 98 | index++; 99 | var formatter = exports.formatters[format]; 100 | if ('function' === typeof formatter) { 101 | var val = args[index]; 102 | match = formatter.call(self, val); 103 | 104 | // now we need to remove `args[index]` since it's inlined in the `format` 105 | args.splice(index, 1); 106 | index--; 107 | } 108 | return match; 109 | }); 110 | 111 | // apply env-specific formatting (colors, etc.) 112 | exports.formatArgs.call(self, args); 113 | 114 | var logFn = debug.log || exports.log || console.log.bind(console); 115 | logFn.apply(self, args); 116 | } 117 | 118 | debug.namespace = namespace; 119 | debug.enabled = exports.enabled(namespace); 120 | debug.useColors = exports.useColors(); 121 | debug.color = selectColor(namespace); 122 | debug.destroy = destroy; 123 | 124 | // env-specific initialization logic for debug instances 125 | if ('function' === typeof exports.init) { 126 | exports.init(debug); 127 | } 128 | 129 | exports.instances.push(debug); 130 | 131 | return debug; 132 | } 133 | 134 | function destroy () { 135 | var index = exports.instances.indexOf(this); 136 | if (index !== -1) { 137 | exports.instances.splice(index, 1); 138 | return true; 139 | } else { 140 | return false; 141 | } 142 | } 143 | 144 | /** 145 | * Enables a debug mode by namespaces. This can include modes 146 | * separated by a colon and wildcards. 147 | * 148 | * @param {String} namespaces 149 | * @api public 150 | */ 151 | 152 | function enable(namespaces) { 153 | exports.save(namespaces); 154 | 155 | exports.names = []; 156 | exports.skips = []; 157 | 158 | var i; 159 | var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); 160 | var len = split.length; 161 | 162 | for (i = 0; i < len; i++) { 163 | if (!split[i]) continue; // ignore empty strings 164 | namespaces = split[i].replace(/\*/g, '.*?'); 165 | if (namespaces[0] === '-') { 166 | exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); 167 | } else { 168 | exports.names.push(new RegExp('^' + namespaces + '$')); 169 | } 170 | } 171 | 172 | for (i = 0; i < exports.instances.length; i++) { 173 | var instance = exports.instances[i]; 174 | instance.enabled = exports.enabled(instance.namespace); 175 | } 176 | } 177 | 178 | /** 179 | * Disable debug output. 180 | * 181 | * @api public 182 | */ 183 | 184 | function disable() { 185 | exports.enable(''); 186 | } 187 | 188 | /** 189 | * Returns true if the given mode name is enabled, false otherwise. 190 | * 191 | * @param {String} name 192 | * @return {Boolean} 193 | * @api public 194 | */ 195 | 196 | function enabled(name) { 197 | if (name[name.length - 1] === '*') { 198 | return true; 199 | } 200 | var i, len; 201 | for (i = 0, len = exports.skips.length; i < len; i++) { 202 | if (exports.skips[i].test(name)) { 203 | return false; 204 | } 205 | } 206 | for (i = 0, len = exports.names.length; i < len; i++) { 207 | if (exports.names[i].test(name)) { 208 | return true; 209 | } 210 | } 211 | return false; 212 | } 213 | 214 | /** 215 | * Coerce `val`. 216 | * 217 | * @param {Mixed} val 218 | * @return {Mixed} 219 | * @api private 220 | */ 221 | 222 | function coerce(val) { 223 | if (val instanceof Error) return val.stack || val.message; 224 | return val; 225 | } 226 | -------------------------------------------------------------------------------- /node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process === 'undefined' || process.type === 'renderer') { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/debug/src/node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | var tty = require('tty'); 6 | var util = require('util'); 7 | 8 | /** 9 | * This is the Node.js implementation of `debug()`. 10 | * 11 | * Expose `debug()` as the module. 12 | */ 13 | 14 | exports = module.exports = require('./debug'); 15 | exports.init = init; 16 | exports.log = log; 17 | exports.formatArgs = formatArgs; 18 | exports.save = save; 19 | exports.load = load; 20 | exports.useColors = useColors; 21 | 22 | /** 23 | * Colors. 24 | */ 25 | 26 | exports.colors = [ 6, 2, 3, 4, 5, 1 ]; 27 | 28 | try { 29 | var supportsColor = require('supports-color'); 30 | if (supportsColor && supportsColor.level >= 2) { 31 | exports.colors = [ 32 | 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 33 | 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 34 | 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 35 | 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 36 | 205, 206, 207, 208, 209, 214, 215, 220, 221 37 | ]; 38 | } 39 | } catch (err) { 40 | // swallow - we only care if `supports-color` is available; it doesn't have to be. 41 | } 42 | 43 | /** 44 | * Build up the default `inspectOpts` object from the environment variables. 45 | * 46 | * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js 47 | */ 48 | 49 | exports.inspectOpts = Object.keys(process.env).filter(function (key) { 50 | return /^debug_/i.test(key); 51 | }).reduce(function (obj, key) { 52 | // camel-case 53 | var prop = key 54 | .substring(6) 55 | .toLowerCase() 56 | .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); 57 | 58 | // coerce string value into JS value 59 | var val = process.env[key]; 60 | if (/^(yes|on|true|enabled)$/i.test(val)) val = true; 61 | else if (/^(no|off|false|disabled)$/i.test(val)) val = false; 62 | else if (val === 'null') val = null; 63 | else val = Number(val); 64 | 65 | obj[prop] = val; 66 | return obj; 67 | }, {}); 68 | 69 | /** 70 | * Is stdout a TTY? Colored output is enabled when `true`. 71 | */ 72 | 73 | function useColors() { 74 | return 'colors' in exports.inspectOpts 75 | ? Boolean(exports.inspectOpts.colors) 76 | : tty.isatty(process.stderr.fd); 77 | } 78 | 79 | /** 80 | * Map %o to `util.inspect()`, all on a single line. 81 | */ 82 | 83 | exports.formatters.o = function(v) { 84 | this.inspectOpts.colors = this.useColors; 85 | return util.inspect(v, this.inspectOpts) 86 | .split('\n').map(function(str) { 87 | return str.trim() 88 | }).join(' '); 89 | }; 90 | 91 | /** 92 | * Map %o to `util.inspect()`, allowing multiple lines if needed. 93 | */ 94 | 95 | exports.formatters.O = function(v) { 96 | this.inspectOpts.colors = this.useColors; 97 | return util.inspect(v, this.inspectOpts); 98 | }; 99 | 100 | /** 101 | * Adds ANSI color escape codes if enabled. 102 | * 103 | * @api public 104 | */ 105 | 106 | function formatArgs(args) { 107 | var name = this.namespace; 108 | var useColors = this.useColors; 109 | 110 | if (useColors) { 111 | var c = this.color; 112 | var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); 113 | var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; 114 | 115 | args[0] = prefix + args[0].split('\n').join('\n' + prefix); 116 | args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); 117 | } else { 118 | args[0] = getDate() + name + ' ' + args[0]; 119 | } 120 | } 121 | 122 | function getDate() { 123 | if (exports.inspectOpts.hideDate) { 124 | return ''; 125 | } else { 126 | return new Date().toISOString() + ' '; 127 | } 128 | } 129 | 130 | /** 131 | * Invokes `util.format()` with the specified arguments and writes to stderr. 132 | */ 133 | 134 | function log() { 135 | return process.stderr.write(util.format.apply(util, arguments) + '\n'); 136 | } 137 | 138 | /** 139 | * Save `namespaces`. 140 | * 141 | * @param {String} namespaces 142 | * @api private 143 | */ 144 | 145 | function save(namespaces) { 146 | if (null == namespaces) { 147 | // If you set a process.env field to null or undefined, it gets cast to the 148 | // string 'null' or 'undefined'. Just delete instead. 149 | delete process.env.DEBUG; 150 | } else { 151 | process.env.DEBUG = namespaces; 152 | } 153 | } 154 | 155 | /** 156 | * Load `namespaces`. 157 | * 158 | * @return {String} returns the previously persisted debug modes 159 | * @api private 160 | */ 161 | 162 | function load() { 163 | return process.env.DEBUG; 164 | } 165 | 166 | /** 167 | * Init logic for `debug` instances. 168 | * 169 | * Create a new `inspectOpts` object in case `useColors` is set 170 | * differently for a particular `debug` instance. 171 | */ 172 | 173 | function init (debug) { 174 | debug.inspectOpts = {}; 175 | 176 | var keys = Object.keys(exports.inspectOpts); 177 | for (var i = 0; i < keys.length; i++) { 178 | debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; 179 | } 180 | } 181 | 182 | /** 183 | * Enable namespaces listed in `process.env.DEBUG` initially. 184 | */ 185 | 186 | exports.enable(load()); 187 | -------------------------------------------------------------------------------- /node_modules/discord-anti-spam/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-present Michael Scofield 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/discord-anti-spam/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | # discord-anti-spam.js 4 | An extremely simple module to prevent spam on your discord server. 5 | 6 | ## Installation 7 | This module assumes you already have a basic [Discord.js](https://discord.js.org/#/) bot setup. 8 | 9 | Once you've done this, setting the anti spam up will be very easy. 10 | And you can follow the code below to get started! 11 | 12 | ```js 13 | const antispam = require("discord-anti-spam"); 14 | 15 | antispam(bot, { 16 | warnBuffer: 3, //Maximum amount of messages allowed to send in the interval time before getting warned. 17 | maxBuffer: 5, // Maximum amount of messages allowed to send in the interval time before getting banned. 18 | interval: 1000, // Amount of time in ms users can send a maximum of the maxBuffer variable before getting banned. 19 | warningMessage: "stop spamming or I'll whack your head off.", // Warning message send to the user indicating they are going to fast. 20 | banMessage: "has been banned for spamming, anyone else?", // Ban message, always tags the banned user in front of it. 21 |  maxDuplicatesWarning: 7,// Maximum amount of duplicate messages a user can send in a timespan before getting warned 22 |  maxDuplicatesBan: 10, // Maximum amount of duplicate messages a user can send in a timespan before getting banned 23 | deleteMessagesAfterBanForPastDays: 7 // Delete the spammed messages after banning for the past x days. 24 | exemptRoles: ["Admin", "Chat Moderator"] // The names of the roles which should not be spam-filtered 25 | exemptUsers: ["user#1234"] // The Discord tags of the users who should not be spam-filtered 26 | }); 27 | 28 | ``` 29 | That's it. enjoy not being raided :) 30 | 31 | If you have any issues, bugs or trouble setting the module up. feel free to open an issue on [Github](https://github.com/Michael-J-Scofield/discord-anti-spam) 32 | -------------------------------------------------------------------------------- /node_modules/discord-anti-spam/anti_spam.js: -------------------------------------------------------------------------------- 1 | const authors = []; 2 | var warned = []; 3 | var banned = []; 4 | var messagelog = []; 5 | 6 | /** 7 | * Add simple spam protection to your discord server. 8 | * @param {Bot} bot - The discord.js CLient/bot 9 | * @param {object} options - Optional (Custom configuarion options) 10 | * @return {[type]} [description] 11 | */ 12 | module.exports = function (bot, options) { 13 | // Set options 14 | const logChannel = (options && options.logChannel); 15 | const warnBuffer = (options && options.warnBuffer) || 3; 16 | const maxBuffer = (options && options.maxBuffer) || 5; 17 | const interval = (options && options.interval) || 1000; 18 | const warningMessage = (options && options.warningMessage) || "stop spamming or I'll whack your head off."; 19 | const banMessage = (options && options.banMessage) || "has been banned for spamming, anyone else?"; 20 | const maxDuplicatesWarning = (options && options. maxDuplicatesWarning || 7); 21 | const maxDuplicatesBan = (options && options. maxDuplicatesBan || 10); 22 | const deleteMessagesAfterBanForPastDays = (options && options.deleteMessagesAfterBanForPastDays || 7); 23 | const exemptRoles = (options && options.exemptRoles) || [] 24 | const exemptUsers = (options && options.exemptUsers) || [] 25 | 26 | bot.on("message", msg => { 27 | 28 | // bots don't ban do they? 29 | if (msg.author.bot) return; 30 | 31 | // Return immediately if user is exempt 32 | if(msg.member && msg.member.roles.some(r => exemptRoles.includes(r.name))) return; 33 | if(exemptUsers.includes(msg.author.tag)) return; 34 | 35 | if ( (msg.author.id != bot.user.id) && msg.channel.guild) { 36 | var now = Math.floor(Date.now()); 37 | authors.push({ 38 | "time": now, 39 | "author": msg.author.id 40 | }); 41 | messagelog.push({ 42 | "message": msg.content, 43 | "author": msg.author.id 44 | }); 45 | 46 | // Check how many times the same message has been sent. 47 | var msgMatch = 0; 48 | for (var i = 0; i < messagelog.length; i++) { 49 | if (messagelog[i].message == msg.content && (messagelog[i].author == msg.author.id) && (msg.author.id !== bot.user.id)) { 50 | msgMatch++; 51 | } 52 | } 53 | // Check matched count 54 | if (msgMatch == maxDuplicatesWarning && !warned.includes(msg.author.id)) { 55 | warn(msg, msg.author.id); 56 | } 57 | if (msgMatch == maxDuplicatesBan && !banned.includes(msg.author.id)) { 58 | ban(msg, msg.author.id); 59 | } 60 | 61 | var matched = 0; 62 | 63 | for (var i = 0; i < authors.length; i++) { 64 | if (authors[i].time > now - interval) { 65 | matched++; 66 | if (matched == warnBuffer && !warned.includes(msg.author.id)) { 67 | warn(msg, msg.author.id); 68 | } 69 | else if (matched == maxBuffer) { 70 | if (!banned.includes(msg.author.id)) { 71 | ban(msg, msg.author.id); 72 | } 73 | } 74 | } 75 | else if (authors[i].time < now - interval) { 76 | authors.splice(i); 77 | warned.splice(warned.indexOf(authors[i])); 78 | banned.splice(warned.indexOf(authors[i])); 79 | } 80 | if (messagelog.length >= 200) { 81 | messagelog.shift(); 82 | } 83 | } 84 | } 85 | }); 86 | 87 | /** 88 | * Warn a user 89 | * @param {Object} msg 90 | * @param {string} userid userid 91 | */ 92 | function warn(msg, userid) { 93 | warned.push(msg.author.id); 94 | msg.channel.send(msg.author + " " + warningMessage); 95 | } 96 | 97 | /** 98 | * Ban a user by the user id 99 | * @param {Object} msg 100 | * @param {string} userid userid 101 | * @return {boolean} True or False 102 | */ 103 | function ban(msg, userid) { 104 | for (var i = 0; i < messagelog.length; i++) { 105 | if (messagelog[i].author == msg.author.id) { 106 | messagelog.splice(i); 107 | } 108 | } 109 | 110 | banned.push(msg.author.id); 111 | 112 | var user = msg.channel.guild.members.find(member => member.user.id === msg.author.id); 113 | if (user) { 114 | user.ban(deleteMessagesAfterBanForPastDays).then((member) => { 115 | //log to ban channel 116 | msg.guild.channels.find("id", logChannel).send(msg.author + " " +banMessage).catch(console.error); 117 | return true; 118 | }).catch(() => { 119 | msg.channel.send("insufficient permission to kick " + msg.author + " for spamming."); 120 | return false; 121 | }); 122 | } 123 | } 124 | 125 | } -------------------------------------------------------------------------------- /node_modules/discord-anti-spam/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "discord-anti-spam", 3 | "_id": "discord-anti-spam@1.1.6", 4 | "_inBundle": false, 5 | "_integrity": "sha512-251YHTOUSE/eKdDENdh1x+Om3oaPvzbyVqS7rv9qHo094syd/GYHEIxYeGiOFwG/2cVUBFi07mWdNbYYTflrYw==", 6 | "_location": "/discord-anti-spam", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "discord-anti-spam", 12 | "name": "discord-anti-spam", 13 | "escapedName": "discord-anti-spam", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/discord-anti-spam/-/discord-anti-spam-1.1.6.tgz", 23 | "_shasum": "9d4a5ec223b7dc5b184dc245aa18e0fc9bb3868c", 24 | "_spec": "discord-anti-spam", 25 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\RandomsBot", 26 | "author": { 27 | "name": "Michael Scofield" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/Michael-J-Scofield/discord-anti-spam/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "deprecated": false, 34 | "description": "Simple discord anti spam package", 35 | "homepage": "https://github.com/Michael-J-Scofield/discord-anti-spam#readme", 36 | "keywords": [ 37 | "Discord", 38 | "spam", 39 | "anti-spam", 40 | "discord.js" 41 | ], 42 | "license": "MIT", 43 | "main": "anti_spam.js", 44 | "name": "discord-anti-spam", 45 | "repository": { 46 | "type": "git", 47 | "url": "git+https://github.com/Michael-J-Scofield/discord-anti-spam.git" 48 | }, 49 | "scripts": { 50 | "test": "echo \"Error: no test specified\" && exit 1" 51 | }, 52 | "version": "1.1.6" 53 | } 54 | -------------------------------------------------------------------------------- /node_modules/follow-redirects/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 Olivier Lalonde , James Talmage , Ruben Verborgh 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /node_modules/follow-redirects/README.md: -------------------------------------------------------------------------------- 1 | ## Follow Redirects 2 | 3 | Drop-in replacement for Nodes `http` and `https` that automatically follows redirects. 4 | 5 | [![npm version](https://badge.fury.io/js/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) 6 | [![Build Status](https://travis-ci.org/olalonde/follow-redirects.svg?branch=master)](https://travis-ci.org/olalonde/follow-redirects) 7 | [![Coverage Status](https://coveralls.io/repos/olalonde/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/olalonde/follow-redirects?branch=master) 8 | [![Dependency Status](https://david-dm.org/olalonde/follow-redirects.svg)](https://david-dm.org/olalonde/follow-redirects) 9 | [![devDependency Status](https://david-dm.org/olalonde/follow-redirects/dev-status.svg)](https://david-dm.org/olalonde/follow-redirects#info=devDependencies) 10 | 11 | [![NPM](https://nodei.co/npm/follow-redirects.png?downloads=true)](https://nodei.co/npm/follow-redirects/) 12 | 13 | `follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) 14 | methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) 15 | modules, with the exception that they will seamlessly follow redirects. 16 | 17 | ```javascript 18 | var http = require('follow-redirects').http; 19 | var https = require('follow-redirects').https; 20 | 21 | http.get('http://bit.ly/900913', function (response) { 22 | response.on('data', function (chunk) { 23 | console.log(chunk); 24 | }); 25 | }).on('error', function (err) { 26 | console.error(err); 27 | }); 28 | ``` 29 | 30 | You can inspect the final redirected URL through the `responseUrl` property on the `response`. 31 | If no redirection happened, `responseUrl` is the original request URL. 32 | 33 | ```javascript 34 | https.request({ 35 | host: 'bitly.com', 36 | path: '/UHfDGO', 37 | }, function (response) { 38 | console.log(response.responseUrl); 39 | // 'http://duckduckgo.com/robots.txt' 40 | }); 41 | ``` 42 | 43 | ## Options 44 | ### Global options 45 | Global options are set directly on the `follow-redirects` module: 46 | 47 | ```javascript 48 | var followRedirects = require('follow-redirects'); 49 | followRedirects.maxRedirects = 10; 50 | followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB 51 | ``` 52 | 53 | The following global options are supported: 54 | 55 | - `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. 56 | 57 | - `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. 58 | 59 | 60 | ### Per-request options 61 | Per-request options are set by passing an `options` object: 62 | 63 | ```javascript 64 | var url = require('url'); 65 | var followRedirects = require('follow-redirects'); 66 | 67 | var options = url.parse('http://bit.ly/900913'); 68 | options.maxRedirects = 10; 69 | http.request(options); 70 | ``` 71 | 72 | In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), 73 | the following per-request options are supported: 74 | - `followRedirects` (default: `true`) – whether redirects should be followed. 75 | 76 | - `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. 77 | 78 | - `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. 79 | 80 | - `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` 81 | 82 | - `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. 83 | 84 | 85 | ### Advanced usage 86 | By default, `follow-redirects` will use the Node.js default implementations 87 | of [`http`](https://nodejs.org/api/http.html) 88 | and [`https`](https://nodejs.org/api/https.html). 89 | To enable features such as caching and/or intermediate request tracking, 90 | you might instead want to wrap `follow-redirects` around custom protocol implementations: 91 | 92 | ```javascript 93 | var followRedirects = require('follow-redirects').wrap({ 94 | http: require('your-custom-http'), 95 | https: require('your-custom-https'), 96 | }); 97 | ``` 98 | 99 | Such custom protocols only need an implementation of the `request` method. 100 | 101 | ## Browserify Usage 102 | 103 | Due to the way `XMLHttpRequest` works, the `browserify` versions of `http` and `https` already follow redirects. 104 | If you are *only* targeting the browser, then this library has little value for you. If you want to write cross 105 | platform code for node and the browser, `follow-redirects` provides a great solution for making the native node 106 | modules behave the same as they do in browserified builds in the browser. To avoid bundling unnecessary code 107 | you should tell browserify to swap out `follow-redirects` with the standard modules when bundling. 108 | To make this easier, you need to change how you require the modules: 109 | 110 | ```javascript 111 | var http = require('follow-redirects/http'); 112 | var https = require('follow-redirects/https'); 113 | ``` 114 | 115 | You can then replace `follow-redirects` in your browserify configuration like so: 116 | 117 | ```javascript 118 | "browser": { 119 | "follow-redirects/http" : "http", 120 | "follow-redirects/https" : "https" 121 | } 122 | ``` 123 | 124 | The `browserify-http` module has not kept pace with node development, and no long behaves identically to the native 125 | module when running in the browser. If you are experiencing problems, you may want to check out 126 | [browserify-http-2](https://www.npmjs.com/package/http-browserify-2). It is more actively maintained and 127 | attempts to address a few of the shortcomings of `browserify-http`. In that case, your browserify config should 128 | look something like this: 129 | 130 | ```javascript 131 | "browser": { 132 | "follow-redirects/http" : "browserify-http-2/http", 133 | "follow-redirects/https" : "browserify-http-2/https" 134 | } 135 | ``` 136 | 137 | ## Contributing 138 | 139 | Pull Requests are always welcome. Please [file an issue](https://github.com/olalonde/follow-redirects/issues) 140 | detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied 141 | by tests. You can run the test suite locally with a simple `npm test` command. 142 | 143 | ## Debug Logging 144 | 145 | `follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging 146 | set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test 147 | suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. 148 | 149 | ## Authors 150 | 151 | - Olivier Lalonde (olalonde@gmail.com) 152 | - James Talmage (james@talmage.io) 153 | - [Ruben Verborgh](https://ruben.verborgh.org/) 154 | 155 | ## License 156 | 157 | MIT: [http://olalonde.mit-license.org](http://olalonde.mit-license.org) 158 | -------------------------------------------------------------------------------- /node_modules/follow-redirects/http.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./").http; 2 | -------------------------------------------------------------------------------- /node_modules/follow-redirects/https.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./").https; 2 | -------------------------------------------------------------------------------- /node_modules/follow-redirects/index.js: -------------------------------------------------------------------------------- 1 | var url = require("url"); 2 | var http = require("http"); 3 | var https = require("https"); 4 | var assert = require("assert"); 5 | var Writable = require("stream").Writable; 6 | var debug = require("debug")("follow-redirects"); 7 | 8 | // RFC7231§4.2.1: Of the request methods defined by this specification, 9 | // the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe. 10 | var SAFE_METHODS = { GET: true, HEAD: true, OPTIONS: true, TRACE: true }; 11 | 12 | // Create handlers that pass events from native requests 13 | var eventHandlers = Object.create(null); 14 | ["abort", "aborted", "error", "socket", "timeout"].forEach(function (event) { 15 | eventHandlers[event] = function (arg) { 16 | this._redirectable.emit(event, arg); 17 | }; 18 | }); 19 | 20 | // An HTTP(S) request that can be redirected 21 | function RedirectableRequest(options, responseCallback) { 22 | // Initialize the request 23 | Writable.call(this); 24 | options.headers = options.headers || {}; 25 | this._options = options; 26 | this._redirectCount = 0; 27 | this._redirects = []; 28 | this._requestBodyLength = 0; 29 | this._requestBodyBuffers = []; 30 | 31 | // Attach a callback if passed 32 | if (responseCallback) { 33 | this.on("response", responseCallback); 34 | } 35 | 36 | // React to responses of native requests 37 | var self = this; 38 | this._onNativeResponse = function (response) { 39 | self._processResponse(response); 40 | }; 41 | 42 | // Complete the URL object when necessary 43 | if (!options.pathname && options.path) { 44 | var searchPos = options.path.indexOf("?"); 45 | if (searchPos < 0) { 46 | options.pathname = options.path; 47 | } 48 | else { 49 | options.pathname = options.path.substring(0, searchPos); 50 | options.search = options.path.substring(searchPos); 51 | } 52 | } 53 | 54 | // Perform the first request 55 | this._performRequest(); 56 | } 57 | RedirectableRequest.prototype = Object.create(Writable.prototype); 58 | 59 | // Writes buffered data to the current native request 60 | RedirectableRequest.prototype.write = function (data, encoding, callback) { 61 | if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { 62 | throw new Error("data should be a string, Buffer or Uint8Array"); 63 | } 64 | if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { 65 | this._requestBodyLength += data.length; 66 | this._requestBodyBuffers.push({ data: data, encoding: encoding }); 67 | this._currentRequest.write(data, encoding, callback); 68 | } 69 | else { 70 | this.emit("error", new Error("Request body larger than maxBodyLength limit")); 71 | this.abort(); 72 | } 73 | }; 74 | 75 | // Ends the current native request 76 | RedirectableRequest.prototype.end = function (data, encoding, callback) { 77 | var currentRequest = this._currentRequest; 78 | if (!data) { 79 | currentRequest.end(null, null, callback); 80 | } 81 | else { 82 | this.write(data, encoding, function () { 83 | currentRequest.end(null, null, callback); 84 | }); 85 | } 86 | }; 87 | 88 | // Sets a header value on the current native request 89 | RedirectableRequest.prototype.setHeader = function (name, value) { 90 | this._options.headers[name] = value; 91 | this._currentRequest.setHeader(name, value); 92 | }; 93 | 94 | // Clears a header value on the current native request 95 | RedirectableRequest.prototype.removeHeader = function (name) { 96 | delete this._options.headers[name]; 97 | this._currentRequest.removeHeader(name); 98 | }; 99 | 100 | // Proxy all other public ClientRequest methods 101 | [ 102 | "abort", "flushHeaders", "getHeader", 103 | "setNoDelay", "setSocketKeepAlive", "setTimeout", 104 | ].forEach(function (method) { 105 | RedirectableRequest.prototype[method] = function (a, b) { 106 | return this._currentRequest[method](a, b); 107 | }; 108 | }); 109 | 110 | // Proxy all public ClientRequest properties 111 | ["aborted", "connection", "socket"].forEach(function (property) { 112 | Object.defineProperty(RedirectableRequest.prototype, property, { 113 | get: function () { return this._currentRequest[property]; }, 114 | }); 115 | }); 116 | 117 | // Executes the next native request (initial or redirect) 118 | RedirectableRequest.prototype._performRequest = function () { 119 | // Load the native protocol 120 | var protocol = this._options.protocol; 121 | var nativeProtocol = this._options.nativeProtocols[protocol]; 122 | 123 | // If specified, use the agent corresponding to the protocol 124 | // (HTTP and HTTPS use different types of agents) 125 | if (this._options.agents) { 126 | var scheme = protocol.substr(0, protocol.length - 1); 127 | this._options.agent = this._options.agents[scheme]; 128 | } 129 | 130 | // Create the native request 131 | var request = this._currentRequest = 132 | nativeProtocol.request(this._options, this._onNativeResponse); 133 | this._currentUrl = url.format(this._options); 134 | 135 | // Set up event handlers 136 | request._redirectable = this; 137 | for (var event in eventHandlers) { 138 | /* istanbul ignore else */ 139 | if (event) { 140 | request.on(event, eventHandlers[event]); 141 | } 142 | } 143 | 144 | // End a redirected request 145 | // (The first request must be ended explicitly with RedirectableRequest#end) 146 | if (this._isRedirect) { 147 | // Write the request entity and end. 148 | var requestBodyBuffers = this._requestBodyBuffers; 149 | (function writeNext() { 150 | if (requestBodyBuffers.length !== 0) { 151 | var buffer = requestBodyBuffers.pop(); 152 | request.write(buffer.data, buffer.encoding, writeNext); 153 | } 154 | else { 155 | request.end(); 156 | } 157 | }()); 158 | } 159 | }; 160 | 161 | // Processes a response from the current native request 162 | RedirectableRequest.prototype._processResponse = function (response) { 163 | // Store the redirected response 164 | if (this._options.trackRedirects) { 165 | this._redirects.push({ 166 | url: this._currentUrl, 167 | headers: response.headers, 168 | statusCode: response.statusCode, 169 | }); 170 | } 171 | 172 | // RFC7231§6.4: The 3xx (Redirection) class of status code indicates 173 | // that further action needs to be taken by the user agent in order to 174 | // fulfill the request. If a Location header field is provided, 175 | // the user agent MAY automatically redirect its request to the URI 176 | // referenced by the Location field value, 177 | // even if the specific status code is not understood. 178 | var location = response.headers.location; 179 | if (location && this._options.followRedirects !== false && 180 | response.statusCode >= 300 && response.statusCode < 400) { 181 | // RFC7231§6.4: A client SHOULD detect and intervene 182 | // in cyclical redirections (i.e., "infinite" redirection loops). 183 | if (++this._redirectCount > this._options.maxRedirects) { 184 | this.emit("error", new Error("Max redirects exceeded.")); 185 | return; 186 | } 187 | 188 | // RFC7231§6.4: Automatic redirection needs to done with 189 | // care for methods not known to be safe […], 190 | // since the user might not wish to redirect an unsafe request. 191 | // RFC7231§6.4.7: The 307 (Temporary Redirect) status code indicates 192 | // that the target resource resides temporarily under a different URI 193 | // and the user agent MUST NOT change the request method 194 | // if it performs an automatic redirection to that URI. 195 | var header; 196 | var headers = this._options.headers; 197 | if (response.statusCode !== 307 && !(this._options.method in SAFE_METHODS)) { 198 | this._options.method = "GET"; 199 | // Drop a possible entity and headers related to it 200 | this._requestBodyBuffers = []; 201 | for (header in headers) { 202 | if (/^content-/i.test(header)) { 203 | delete headers[header]; 204 | } 205 | } 206 | } 207 | 208 | // Drop the Host header, as the redirect might lead to a different host 209 | if (!this._isRedirect) { 210 | for (header in headers) { 211 | if (/^host$/i.test(header)) { 212 | delete headers[header]; 213 | } 214 | } 215 | } 216 | 217 | // Perform the redirected request 218 | var redirectUrl = url.resolve(this._currentUrl, location); 219 | debug("redirecting to", redirectUrl); 220 | Object.assign(this._options, url.parse(redirectUrl)); 221 | this._isRedirect = true; 222 | this._performRequest(); 223 | 224 | // Discard the remainder of the response to avoid waiting for data 225 | response.destroy(); 226 | } 227 | else { 228 | // The response is not a redirect; return it as-is 229 | response.responseUrl = this._currentUrl; 230 | response.redirects = this._redirects; 231 | this.emit("response", response); 232 | 233 | // Clean up 234 | this._requestBodyBuffers = []; 235 | } 236 | }; 237 | 238 | // Wraps the key/value object of protocols with redirect functionality 239 | function wrap(protocols) { 240 | // Default settings 241 | var exports = { 242 | maxRedirects: 21, 243 | maxBodyLength: 10 * 1024 * 1024, 244 | }; 245 | 246 | // Wrap each protocol 247 | var nativeProtocols = {}; 248 | Object.keys(protocols).forEach(function (scheme) { 249 | var protocol = scheme + ":"; 250 | var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; 251 | var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); 252 | 253 | // Executes a request, following redirects 254 | wrappedProtocol.request = function (options, callback) { 255 | if (typeof options === "string") { 256 | options = url.parse(options); 257 | options.maxRedirects = exports.maxRedirects; 258 | } 259 | else { 260 | options = Object.assign({ 261 | protocol: protocol, 262 | maxRedirects: exports.maxRedirects, 263 | maxBodyLength: exports.maxBodyLength, 264 | }, options); 265 | } 266 | options.nativeProtocols = nativeProtocols; 267 | assert.equal(options.protocol, protocol, "protocol mismatch"); 268 | debug("options", options); 269 | return new RedirectableRequest(options, callback); 270 | }; 271 | 272 | // Executes a GET request, following redirects 273 | wrappedProtocol.get = function (options, callback) { 274 | var request = wrappedProtocol.request(options, callback); 275 | request.end(); 276 | return request; 277 | }; 278 | }); 279 | return exports; 280 | } 281 | 282 | // Exports 283 | module.exports = wrap({ http: http, https: https }); 284 | module.exports.wrap = wrap; 285 | -------------------------------------------------------------------------------- /node_modules/follow-redirects/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "follow-redirects@^1.3.0", 3 | "_id": "follow-redirects@1.5.1", 4 | "_inBundle": false, 5 | "_integrity": "sha512-v9GI1hpaqq1ZZR6pBD1+kI7O24PhDvNGNodjS3MdcEqyrahCp8zbtpv+2B/krUnSmUH80lbAS7MrdeK5IylgKg==", 6 | "_location": "/follow-redirects", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "follow-redirects@^1.3.0", 12 | "name": "follow-redirects", 13 | "escapedName": "follow-redirects", 14 | "rawSpec": "^1.3.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.3.0" 17 | }, 18 | "_requiredBy": [ 19 | "/axios" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.1.tgz", 22 | "_shasum": "67a8f14f5a1f67f962c2c46469c79eaec0a90291", 23 | "_spec": "follow-redirects@^1.3.0", 24 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\MerlinBot\\node_modules\\axios", 25 | "author": { 26 | "name": "Olivier Lalonde", 27 | "email": "olalonde@gmail.com", 28 | "url": "http://www.syskall.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/olalonde/follow-redirects/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "contributors": [ 35 | { 36 | "name": "James Talmage", 37 | "email": "james@talmage.io" 38 | }, 39 | { 40 | "name": "Ruben Verborgh", 41 | "email": "ruben@verborgh.org", 42 | "url": "https://ruben.verborgh.org/" 43 | } 44 | ], 45 | "dependencies": { 46 | "debug": "^3.1.0" 47 | }, 48 | "deprecated": false, 49 | "description": "HTTP and HTTPS modules that follow redirects.", 50 | "devDependencies": { 51 | "bluebird": "^3.5.1", 52 | "concat-stream": "^1.6.0", 53 | "coveralls": "^3.0.0", 54 | "eslint": "^4.19.1", 55 | "express": "^4.16.2", 56 | "mocha": "^5.0.0", 57 | "nyc": "^11.8.0" 58 | }, 59 | "engines": { 60 | "node": ">=4.0" 61 | }, 62 | "files": [ 63 | "index.js", 64 | "create.js", 65 | "http.js", 66 | "https.js" 67 | ], 68 | "homepage": "https://github.com/olalonde/follow-redirects", 69 | "keywords": [ 70 | "http", 71 | "https", 72 | "url", 73 | "redirect", 74 | "client", 75 | "location", 76 | "utility" 77 | ], 78 | "license": "MIT", 79 | "main": "index.js", 80 | "name": "follow-redirects", 81 | "nyc": { 82 | "reporter": [ 83 | "lcov", 84 | "text" 85 | ] 86 | }, 87 | "repository": { 88 | "type": "git", 89 | "url": "git+ssh://git@github.com/olalonde/follow-redirects.git" 90 | }, 91 | "scripts": { 92 | "lint": "eslint *.js test", 93 | "mocha": "nyc mocha", 94 | "test": "npm run lint && npm run mocha" 95 | }, 96 | "version": "1.5.1" 97 | } 98 | -------------------------------------------------------------------------------- /node_modules/is-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/is-buffer/README.md: -------------------------------------------------------------------------------- 1 | # is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] 2 | 3 | [travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg 4 | [travis-url]: https://travis-ci.org/feross/is-buffer 5 | [npm-image]: https://img.shields.io/npm/v/is-buffer.svg 6 | [npm-url]: https://npmjs.org/package/is-buffer 7 | [downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg 8 | [downloads-url]: https://npmjs.org/package/is-buffer 9 | [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg 10 | [standard-url]: https://standardjs.com 11 | 12 | #### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer)) 13 | 14 | [![saucelabs][saucelabs-image]][saucelabs-url] 15 | 16 | [saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg 17 | [saucelabs-url]: https://saucelabs.com/u/is-buffer 18 | 19 | ## Why not use `Buffer.isBuffer`? 20 | 21 | This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)). 22 | 23 | It's future-proof and works in node too! 24 | 25 | ## install 26 | 27 | ```bash 28 | npm install is-buffer 29 | ``` 30 | 31 | ## usage 32 | 33 | ```js 34 | var isBuffer = require('is-buffer') 35 | 36 | isBuffer(new Buffer(4)) // true 37 | 38 | isBuffer(undefined) // false 39 | isBuffer(null) // false 40 | isBuffer('') // false 41 | isBuffer(true) // false 42 | isBuffer(false) // false 43 | isBuffer(0) // false 44 | isBuffer(1) // false 45 | isBuffer(1.0) // false 46 | isBuffer('string') // false 47 | isBuffer({}) // false 48 | isBuffer(function foo () {}) // false 49 | ``` 50 | 51 | ## license 52 | 53 | MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). 54 | -------------------------------------------------------------------------------- /node_modules/is-buffer/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Determine if an object is a Buffer 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | 8 | // The _isBuffer check is for Safari 5-7 support, because it's missing 9 | // Object.prototype.constructor. Remove this eventually 10 | module.exports = function (obj) { 11 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) 12 | } 13 | 14 | function isBuffer (obj) { 15 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) 16 | } 17 | 18 | // For Node v0.10 support. Remove this eventually. 19 | function isSlowBuffer (obj) { 20 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) 21 | } 22 | -------------------------------------------------------------------------------- /node_modules/is-buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "is-buffer@^1.1.5", 3 | "_id": "is-buffer@1.1.6", 4 | "_inBundle": false, 5 | "_integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", 6 | "_location": "/is-buffer", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "is-buffer@^1.1.5", 12 | "name": "is-buffer", 13 | "escapedName": "is-buffer", 14 | "rawSpec": "^1.1.5", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.5" 17 | }, 18 | "_requiredBy": [ 19 | "/axios" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", 22 | "_shasum": "efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be", 23 | "_spec": "is-buffer@^1.1.5", 24 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\MerlinBot\\node_modules\\axios", 25 | "author": { 26 | "name": "Feross Aboukhadijeh", 27 | "email": "feross@feross.org", 28 | "url": "http://feross.org/" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/feross/is-buffer/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": {}, 35 | "deprecated": false, 36 | "description": "Determine if an object is a Buffer", 37 | "devDependencies": { 38 | "standard": "*", 39 | "tape": "^4.0.0", 40 | "zuul": "^3.0.0" 41 | }, 42 | "homepage": "https://github.com/feross/is-buffer#readme", 43 | "keywords": [ 44 | "buffer", 45 | "buffers", 46 | "type", 47 | "core buffer", 48 | "browser buffer", 49 | "browserify", 50 | "typed array", 51 | "uint32array", 52 | "int16array", 53 | "int32array", 54 | "float32array", 55 | "float64array", 56 | "browser", 57 | "arraybuffer", 58 | "dataview" 59 | ], 60 | "license": "MIT", 61 | "main": "index.js", 62 | "name": "is-buffer", 63 | "repository": { 64 | "type": "git", 65 | "url": "git://github.com/feross/is-buffer.git" 66 | }, 67 | "scripts": { 68 | "test": "standard && npm run test-node && npm run test-browser", 69 | "test-browser": "zuul -- test/*.js", 70 | "test-browser-local": "zuul --local -- test/*.js", 71 | "test-node": "tape test/*.js" 72 | }, 73 | "testling": { 74 | "files": "test/*.js" 75 | }, 76 | "version": "1.1.6" 77 | } 78 | -------------------------------------------------------------------------------- /node_modules/is-buffer/test/basic.js: -------------------------------------------------------------------------------- 1 | var isBuffer = require('../') 2 | var test = require('tape') 3 | 4 | test('is-buffer', function (t) { 5 | t.equal(isBuffer(Buffer.alloc(4)), true, 'new Buffer(4)') 6 | t.equal(isBuffer(Buffer.allocUnsafeSlow(100)), true, 'SlowBuffer(100)') 7 | 8 | t.equal(isBuffer(undefined), false, 'undefined') 9 | t.equal(isBuffer(null), false, 'null') 10 | t.equal(isBuffer(''), false, 'empty string') 11 | t.equal(isBuffer(true), false, 'true') 12 | t.equal(isBuffer(false), false, 'false') 13 | t.equal(isBuffer(0), false, '0') 14 | t.equal(isBuffer(1), false, '1') 15 | t.equal(isBuffer(1.0), false, '1.0') 16 | t.equal(isBuffer('string'), false, 'string') 17 | t.equal(isBuffer({}), false, '{}') 18 | t.equal(isBuffer([]), false, '[]') 19 | t.equal(isBuffer(function foo () {}), false, 'function foo () {}') 20 | t.equal(isBuffer({ isBuffer: null }), false, '{ isBuffer: null }') 21 | t.equal(isBuffer({ isBuffer: function () { throw new Error() } }), false, '{ isBuffer: function () { throw new Error() } }') 22 | 23 | t.end() 24 | }) 25 | -------------------------------------------------------------------------------- /node_modules/ms/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Helpers. 3 | */ 4 | 5 | var s = 1000; 6 | var m = s * 60; 7 | var h = m * 60; 8 | var d = h * 24; 9 | var y = d * 365.25; 10 | 11 | /** 12 | * Parse or format the given `val`. 13 | * 14 | * Options: 15 | * 16 | * - `long` verbose formatting [false] 17 | * 18 | * @param {String|Number} val 19 | * @param {Object} [options] 20 | * @throws {Error} throw an error if val is not a non-empty string or a number 21 | * @return {String|Number} 22 | * @api public 23 | */ 24 | 25 | module.exports = function(val, options) { 26 | options = options || {}; 27 | var type = typeof val; 28 | if (type === 'string' && val.length > 0) { 29 | return parse(val); 30 | } else if (type === 'number' && isNaN(val) === false) { 31 | return options.long ? fmtLong(val) : fmtShort(val); 32 | } 33 | throw new Error( 34 | 'val is not a non-empty string or a valid number. val=' + 35 | JSON.stringify(val) 36 | ); 37 | }; 38 | 39 | /** 40 | * Parse the given `str` and return milliseconds. 41 | * 42 | * @param {String} str 43 | * @return {Number} 44 | * @api private 45 | */ 46 | 47 | function parse(str) { 48 | str = String(str); 49 | if (str.length > 100) { 50 | return; 51 | } 52 | var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( 53 | str 54 | ); 55 | if (!match) { 56 | return; 57 | } 58 | var n = parseFloat(match[1]); 59 | var type = (match[2] || 'ms').toLowerCase(); 60 | switch (type) { 61 | case 'years': 62 | case 'year': 63 | case 'yrs': 64 | case 'yr': 65 | case 'y': 66 | return n * y; 67 | case 'days': 68 | case 'day': 69 | case 'd': 70 | return n * d; 71 | case 'hours': 72 | case 'hour': 73 | case 'hrs': 74 | case 'hr': 75 | case 'h': 76 | return n * h; 77 | case 'minutes': 78 | case 'minute': 79 | case 'mins': 80 | case 'min': 81 | case 'm': 82 | return n * m; 83 | case 'seconds': 84 | case 'second': 85 | case 'secs': 86 | case 'sec': 87 | case 's': 88 | return n * s; 89 | case 'milliseconds': 90 | case 'millisecond': 91 | case 'msecs': 92 | case 'msec': 93 | case 'ms': 94 | return n; 95 | default: 96 | return undefined; 97 | } 98 | } 99 | 100 | /** 101 | * Short format for `ms`. 102 | * 103 | * @param {Number} ms 104 | * @return {String} 105 | * @api private 106 | */ 107 | 108 | function fmtShort(ms) { 109 | if (ms >= d) { 110 | return Math.round(ms / d) + 'd'; 111 | } 112 | if (ms >= h) { 113 | return Math.round(ms / h) + 'h'; 114 | } 115 | if (ms >= m) { 116 | return Math.round(ms / m) + 'm'; 117 | } 118 | if (ms >= s) { 119 | return Math.round(ms / s) + 's'; 120 | } 121 | return ms + 'ms'; 122 | } 123 | 124 | /** 125 | * Long format for `ms`. 126 | * 127 | * @param {Number} ms 128 | * @return {String} 129 | * @api private 130 | */ 131 | 132 | function fmtLong(ms) { 133 | return plural(ms, d, 'day') || 134 | plural(ms, h, 'hour') || 135 | plural(ms, m, 'minute') || 136 | plural(ms, s, 'second') || 137 | ms + ' ms'; 138 | } 139 | 140 | /** 141 | * Pluralization helper. 142 | */ 143 | 144 | function plural(ms, n, name) { 145 | if (ms < n) { 146 | return; 147 | } 148 | if (ms < n * 1.5) { 149 | return Math.floor(ms / n) + ' ' + name; 150 | } 151 | return Math.ceil(ms / n) + ' ' + name + 's'; 152 | } 153 | -------------------------------------------------------------------------------- /node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/ms/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "ms@2.0.0", 3 | "_id": "ms@2.0.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", 6 | "_location": "/ms", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "ms@2.0.0", 12 | "name": "ms", 13 | "escapedName": "ms", 14 | "rawSpec": "2.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "2.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/debug" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 22 | "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", 23 | "_spec": "ms@2.0.0", 24 | "_where": "C:\\Users\\silve\\Documents\\NerdNu\\Discord\\MerlinBot\\node_modules\\debug", 25 | "bugs": { 26 | "url": "https://github.com/zeit/ms/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "deprecated": false, 30 | "description": "Tiny milisecond conversion utility", 31 | "devDependencies": { 32 | "eslint": "3.19.0", 33 | "expect.js": "0.3.1", 34 | "husky": "0.13.3", 35 | "lint-staged": "3.4.1", 36 | "mocha": "3.4.1" 37 | }, 38 | "eslintConfig": { 39 | "extends": "eslint:recommended", 40 | "env": { 41 | "node": true, 42 | "es6": true 43 | } 44 | }, 45 | "files": [ 46 | "index.js" 47 | ], 48 | "homepage": "https://github.com/zeit/ms#readme", 49 | "license": "MIT", 50 | "lint-staged": { 51 | "*.js": [ 52 | "npm run lint", 53 | "prettier --single-quote --write", 54 | "git add" 55 | ] 56 | }, 57 | "main": "./index", 58 | "name": "ms", 59 | "repository": { 60 | "type": "git", 61 | "url": "git+https://github.com/zeit/ms.git" 62 | }, 63 | "scripts": { 64 | "lint": "eslint lib/* bin/*", 65 | "precommit": "lint-staged", 66 | "test": "mocha tests.js" 67 | }, 68 | "version": "2.0.0" 69 | } 70 | -------------------------------------------------------------------------------- /node_modules/ms/readme.md: -------------------------------------------------------------------------------- 1 | # ms 2 | 3 | [![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) 4 | [![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) 5 | 6 | Use this package to easily convert various time formats to milliseconds. 7 | 8 | ## Examples 9 | 10 | ```js 11 | ms('2 days') // 172800000 12 | ms('1d') // 86400000 13 | ms('10h') // 36000000 14 | ms('2.5 hrs') // 9000000 15 | ms('2h') // 7200000 16 | ms('1m') // 60000 17 | ms('5s') // 5000 18 | ms('1y') // 31557600000 19 | ms('100') // 100 20 | ``` 21 | 22 | ### Convert from milliseconds 23 | 24 | ```js 25 | ms(60000) // "1m" 26 | ms(2 * 60000) // "2m" 27 | ms(ms('10 hours')) // "10h" 28 | ``` 29 | 30 | ### Time format written-out 31 | 32 | ```js 33 | ms(60000, { long: true }) // "1 minute" 34 | ms(2 * 60000, { long: true }) // "2 minutes" 35 | ms(ms('10 hours'), { long: true }) // "10 hours" 36 | ``` 37 | 38 | ## Features 39 | 40 | - Works both in [node](https://nodejs.org) and in the browser. 41 | - If a number is supplied to `ms`, a string with a unit is returned. 42 | - If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). 43 | - If you pass a string with a number and a valid unit, the number of equivalent ms is returned. 44 | 45 | ## Caught a bug? 46 | 47 | 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device 48 | 2. Link the package to the global module directory: `npm link` 49 | 3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! 50 | 51 | As always, you can run the tests using: `npm test` 52 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "axios": { 6 | "version": "0.18.0", 7 | "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", 8 | "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", 9 | "requires": { 10 | "follow-redirects": "1.5.1", 11 | "is-buffer": "1.1.6" 12 | } 13 | }, 14 | "debug": { 15 | "version": "3.1.0", 16 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 17 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 18 | "requires": { 19 | "ms": "2.0.0" 20 | } 21 | }, 22 | "discord-anti-spam": { 23 | "version": "1.1.6", 24 | "resolved": "https://registry.npmjs.org/discord-anti-spam/-/discord-anti-spam-1.1.6.tgz", 25 | "integrity": "sha512-251YHTOUSE/eKdDENdh1x+Om3oaPvzbyVqS7rv9qHo094syd/GYHEIxYeGiOFwG/2cVUBFi07mWdNbYYTflrYw==" 26 | }, 27 | "follow-redirects": { 28 | "version": "1.5.1", 29 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.1.tgz", 30 | "integrity": "sha512-v9GI1hpaqq1ZZR6pBD1+kI7O24PhDvNGNodjS3MdcEqyrahCp8zbtpv+2B/krUnSmUH80lbAS7MrdeK5IylgKg==", 31 | "requires": { 32 | "debug": "3.1.0" 33 | } 34 | }, 35 | "is-buffer": { 36 | "version": "1.1.6", 37 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", 38 | "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" 39 | }, 40 | "ms": { 41 | "version": "2.0.0", 42 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 43 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 44 | } 45 | } 46 | } 47 | --------------------------------------------------------------------------------