Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

arshadkazmi42/ak-url-validate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

64 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

URL Validate

Build Status NPM Downloads Package Size NPM Version Contributors Commit

This library helps in validating whether a url exists or not. It verifies url pattern and whether the url is up and running.

Buy Me A Coffee Become a Patron!

Please consider donating, if you like my work

Install

npm install ak-url-validate

Usage

var auv = require('ak-url-validate');

const url = 'http://github.com/arshadkazmi42';
const response = await auv.isValidUrl(url);
if (response.isValid) {
  // Do something if the url is valid
} else {
  // Do something if url is invalid
}

Status Codes

isValid function returns status code whatever is returned from the url response. Some of the status codes are mentioned below

  • SUCCESS: This code is returned when the url is up and running.
{
  code: "SUCCESS",
  isValid: true
}
  • 404: This code is returned when the url is not found.
{
  code: 404,
  isValid: false,
  message: "Not Found"
}
  • ETIMEDOUT: This code is returned when the url is not responsding and get timed out.
{ 
  isValid: false, 
  code: "ETIMEDOUT",
  message: "Invalid Url" 
}
  • INVALID: This is an exception code, if the url does not return any status code, this code is returned in the response
{
  isValid: false, 
  code: "INVALID",
  message: "Invalid Url" 
}

Contributing Guidelines

Read the contributing guidelines here

Contributors