@ehtashamali/tinyurl

2.1.0 • Public • Published

Node.js Module for tinyUrl

Coverage Status

Build Status

Getting Started

Built over TINYURL API

This module provides two functions: Shorten and Convert

Alnog with two Utill functions: extractHostname and extractRootDomain

Installation

NPM

Using npm:

npm i @ehtashamali/tinyurl

Example

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));

Built With

Contributing

Please read [CONTRIBUTING.md] under docs for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Author

  • Ehtasham Ali

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

emoji-log

Connect

GitHub @EhtashamAli (follow)

LinkedIn @ehtashamali786 (connect)

Package Sidebar

Install

npm i @ehtashamali/tinyurl

Weekly Downloads

3

Version

2.1.0

License

(MIT)

Unpacked Size

8.87 kB

Total Files

5

Last publish

Collaborators

  • ehtashamali