Socket
Socket
Sign inDemoInstall

isurl

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    isurl

Checks whether a value is a WHATWG URL.


Version published
Maintainers
1
Created

Package description

What is isurl?

The 'isurl' npm package is a utility library designed to provide a simple and efficient way to validate and manipulate URLs in Node.js applications. It offers functions to check if a given string is a valid URL and to parse URLs into their components.

What are isurl's main functionalities?

URL Validation

This feature allows developers to check if a string is a valid URL. It returns true if the string is a valid URL and false otherwise. This is useful for validating user input or data fetched from external sources.

const isUrl = require('isurl');

console.log(isUrl('https://www.example.com')); // true
console.log(isUrl('not-a-url')); // false

URL Parsing

This feature provides the ability to parse a URL into its constituent parts, such as protocol, host, path, and query string. This can be particularly useful for applications that need to manipulate or extract information from URLs.

const isUrl = require('isurl');
const url = isUrl.parse('https://www.example.com/path?query=123');

console.log(url.protocol); // 'https:'
console.log(url.host); // 'www.example.com'
console.log(url.pathname); // '/path'
console.log(url.search); // '?query=123'

Other packages similar to isurl

Readme

Source

isurl NPM Version Build Status

Checks whether a value is a WHATWG URL.

Works cross-realm/iframe.

Installation

Node.js >= 4 is required. To install, type this at the command line:

npm install isurl

Usage

const isURL = require('isurl');
const assert = require('assert');
 
assert.equal(isURL('http://domain/'), false);
assert.equal(isURL(new URL('http://domain/')), true);

Keywords

FAQs

Last updated on 26 Mar 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc