# @types/valid-url

> TypeScript definitions for valid-url

Latest version **1.0.7** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/valid-url
pnpm add @types/valid-url
yarn add @types/valid-url
bun add @types/valid-url
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-11-07 |
| First published | 2016-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51484 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/valid-url
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/valid-url
- npm.io page: https://npm.io/package/@types/valid-url

## Recent versions

- 1.0.7 (latest) — 2023-11-07
- 1.0.4 (ts4.2) — 2023-02-15
- 1.0.3 (ts2.9) — 2020-03-25
- 1.0.2 (ts2.0) — 2016-11-05
- 1.0.6 — 2023-10-18
- 1.0.5 — 2023-09-26
- 1.0.1 — 2016-10-26

## README

# Installation
> `npm install --save @types/valid-url`

# Summary
This package contains type definitions for valid-url (https://github.com/ogt/valid-url).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/valid-url.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/valid-url/index.d.ts)
````ts
/**
 * Is the value a well-formed uri?
 * Returns the untainted URI if the test value appears to be well-formed.  Note that you may really want one of the more practical methods like is_http_uri or is_https_uri, since the URI standard (RFC 3986) allows a lot of things you probably don't want.
 * @param value - The potential URI to test.
 * @returns The untainted RFC 3986 URI on success, undefined on failure.
 */
export function isUri(value: string): string | undefined;

/**
 * Is the value a well-formed HTTP uri?
 * Specialized version of isUri() that only likes http:// urls.  As a result, it can also do a much more thorough job validating.  Also, unlike isUri() it is more concerned with only allowing real-world URIs through.  Things like relative hostnames are allowed by the standards, but probably aren't wise.  Conversely, null paths aren't allowed per RFC 2616 (should be '/' instead), but are allowed by this function.
 *
 * This function only works for fully-qualified URIs.  /bob.html won't work. See RFC 3986 for the appropriate method to turn a relative URI into an absolute one given its context.
 *
 * Note that you probably want to either call this in combo with is_https_uri().
 * i.e. if(isHttpUri(uri) || isHttpsUri(uri)) console.log('Good');
 * or use the convenience method isWebUri which is equivalent.
 * @param value - The potential URI to test.
 * @returns The untainted RFC 3986 URI on success, undefined on failure.
 */
export function isHttpUri(value: string): string | undefined;

/**
 * Is the value a well-formed HTTPS uri?
 * See is_http_uri() for details.  This version only likes the https URI scheme. Otherwise it's identical to is_http_uri().
 * @param value - The potential URI to test.
 * @returns The untainted RFC 3986 URI on success, undefined on failure.
 */
export function isHttpsUri(value: string): string | undefined;

/**
 * Is the value a well-formed HTTP or HTTPS uri?
 * This is just a convenience method that combines isHttpUri and isHttpsUri to accept most common real-world URLs.
 * @param value - The potential URI to test.
 * @returns The untainted RFC 3986 URI on success, undefined on failure.
 */
export function isWebUri(value: string): string | undefined;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by [Gabriel Cangussu](https://github.com/gcangussu).

---
_Source: https://npm.io/package/@types/valid-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
