1.0.0 • Published 6 years ago

url-builder-js v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

url-builder

A package that builds URLs through JavaScript

Usage

const url = new URL().isWWW(false).isHTTP(false).setDomain("github").setEnding("com").addDirectory("galactic-packages").addDirectory("url-builder").getURL();
console.log(url);

This outputs https://github.com/galactic-packages/url-builder/

Types

AttributeData TypeDescription
URL()classUsed to set the URL object
.isWWW()booleanSpecifies if the domain includes www
.isHTTP()booleanSpecifies if the domain is http or https
.setSubdomain()stringSets the subdomain of the URL
.setDomain()stringSets the domain of the url
.setEnding()stringSets the ending of the url (com, org, net, edu, etc)
.addDirectory()stringAdd a directory to the URL
.getURL()noneReturns the whole URL, with the settings specified above

Optional Settings

The settings above are optional excluding .setDomain() and .setEnding(). All other settings are set automatically, unless specified by the user.