mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
tinify webpacks (#1975)
* tinify webpack * meme * fix long version * more changes * even smoler * fix up logic * fix build * undo changes to user agent manager because its not webpack'd anymore * the heck * fix stupid * clean up browser rules * typo
This commit is contained in:
@@ -3,6 +3,7 @@ const snekfetch = require('snekfetch');
|
||||
const { Colors, DefaultOptions, Endpoints } = require('./Constants');
|
||||
const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
||||
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;
|
||||
|
||||
/**
|
||||
* Contains various general-purpose utility methods. These functions are also available on the base `Discord` object.
|
||||
@@ -307,6 +308,14 @@ class Util {
|
||||
updatedItems = updatedItems.map((r, i) => ({ id: r.id, position: i }));
|
||||
return route.patch({ data: updatedItems, reason });
|
||||
}
|
||||
|
||||
static basename(path, ext) {
|
||||
let f = splitPathRe.exec(path).slice(1)[2];
|
||||
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||
f = f.substr(0, f.length - ext.length);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Util;
|
||||
|
||||
Reference in New Issue
Block a user