Takes url string, tries to return just the domain
Basic usage example:
const url = require('stringman').url; // or `import {url} from 'stringman'`;
const domain = url.getDomain('https://www.google.com/test');
console.log(domain); // '[google.com]'
Takes a string and returns whether string is a valid URL as a boolean
Basic usage example:
const url = require('stringman').url; // or `import {url} from 'stringman'`;
const valid = url.isValid('https://joeyg.me');
const invalid = url.isValid('https/joeyg.me');
console.log(valid); // true
console.log(invalid); // false
Takes string, removes any URLs, trims, and returns string
Basic usage example:
const url = require('stringman').url; // or `import {url} from 'stringman'`;
const removed = url.remove('the url to my portfolio is https://joeyg.me');
console.log(removed); // 'the url to my portfolio is'
Takes string and returns any matches for a valid URL from the string
Basic usage example:
const url = require('stringman').url; // or `import {url} from 'stringman'`;
const justUrl = url.retrieve('the url to my portfolio is https://joeyg.me');
console.log(justUrl); // 'https://joeyg.me'
takes a string with a url and a second string, swaps any urls in the first string with the second string, and returns the result
Basic usage example:
const url = require('stringman').url; // or `import {url} from 'stringman'`;
const swapped = url.swap('this is a test for https://test.com', 'http://www.fakesite.org');
console.log(swapped); // 'this is a test for http://www.fakesite.org'
Generated using TypeDoc
Returns RegExp for testing URLs