is-a-discord-invite
Version:
A simple package to check if a string is a Discord invite.
18 lines (17 loc) • 772 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.check = exports.defaultOptions = void 0;
const regex_1 = require("./lib/regex");
exports.defaultOptions = {
checkDefaultDiscordDomains: true,
checkOtherDiscordDomains: true,
checkOtherDomains: false,
};
// Check if a string or URL contains a Discord invite link
const check = (value, options = exports.defaultOptions) => {
const formattedOptions = Object.assign(Object.assign({}, exports.defaultOptions), options);
// Check if the value is a URL Object and convert it to a String
const formatedValue = value instanceof URL ? value.toString() : value;
return (0, regex_1.RegexCheck)(formatedValue, formattedOptions);
};
exports.check = check;