New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ak-url-validate

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ak-url-validate

Async url ping validation

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

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

Keywords

validate

FAQs

Package last updated on 04 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts