UNPKG

stringman

Version:

Stringman does string manipulation and other string operations. Do anything from lightening color codes to swapping email address in a string!

34 lines (33 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.url = void 0; const common_1 = require("./utility/common"); const urlStr = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gm; const domainExp = /^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/\n]+)/im; function retrieve(str) { return common_1.common.retrieve(str, urlStr); } function isValid(str) { return common_1.common.isValid(str, urlStr); } function remove(str) { return common_1.common.remove(str, urlStr); } function swap(str, other) { return common_1.common.swap(str, other, urlStr); } function getDomain(str) { return common_1.common.retrieve(str, domainExp).splice(1); } function expression() { return urlStr; } const url = { expression, getDomain, isValid, remove, retrieve, swap }; exports.url = url;