Built over TINYURL API
This module provides two functions: Shorten and Convert
Alnog with two Utill functions: extractHostname and extractRootDomain
Using npm:
npm i @ehtashamali/tinyurl
let {
shorten,
convert,
extractHostname,
extractRootDomain
} = require("tiny-url");
//Without Alias
shorten("https://stackoverflow.com")
.then(link => {
//returns shorten url ex: tinyurl.com/adwa222
console.log("Short Url:", link);
})
.catch(error => console.log(error.message));
//With Alias
shorten("https://stackoverflow.com", "MyTestAlias")
.then(link => {
//returns shorten url ex: tinyurl.com/MyTestAlias
console.log("Short Url:", link);
})
.catch(error => console.log(error.message));
convert(link)
.then(result => {
//returns target url
console.log("Converted: ", result);
})
.catch(error => console.log(error.message));
extractHostname("https://stackoverflow.com")
.then(result => {
//returns stackoverflow.com
console.log("Hostname: ", result);
})
.catch(error => console.log(error.message));
extractRootDomain("https://stackoverflow.com")
.then(result => {
//returns stackoverflow.com
console.log("RootDomain: ", result);
})
.catch(error => console.log(error.message));
- http - HTTP
Please read [CONTRIBUTING.md] under docs for details on our code of conduct, and the process for submitting pull requests to us.
I use SemVer for versioning. For the versions available, see the tags on this repository.
- Ehtasham Ali
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details