npm.io
2.0.2 • Published 2 years ago

@types/is-http-url

Licence
MIT
Version
2.0.2
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.3K

Installation

npm install --save @types/is-http-url

Summary

This package contains type definitions for is-http-url (https://github.com/emilbayes/is-http-url#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/is-http-url.

index.d.ts

export = isHttpUrl;

/**
 * Validate URLs for sane values.
 *
 * Does the following:
 *
 * - Protocol should be one of `http:` or `https:`
 * - Hostname should be [valid domain](http://github.com/emilbayes/is-domain-name) name or IPv4 address (TODO: IPv6)
 * - Port, if given, should be an integer in the range `[1, 65535]`
 *
 * @example
 * // Example usage could be to validate the Origin or Referer HTTP headers
 * import * as assert from 'assert'
 * import isHttpUrl = require('is-http-url')
 *
 * assert.ok(isHttpUrl('http://example.com/hello-world.txt'))
 * assert.ok(!isHttpUrl('//test'))
 */
declare function isHttpUrl(url: string): boolean;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.