@execonline-inc/url
TypeScript icon, indicating that this package has built-in type declarations

8.2.0 • Public • Published

url

The url package provides functions to validate URLs.

Types

InvalidUrlError

interface InvalidUrlError {
  kind: 'invalid-url-error';
  href: string;
  base?: string | URL;
  error: unknown;
}

Functions

invalidUrlError

This function constructs an InvalidUrlError object from the given parameters.

import { invalidUrlError, InvalidUrlError } from '@execonline-inc/url';

const error: unknown = {};
const href: string = 'href';
const base: string = 'base';
const result: InvalidUrlError = invalidUrlError(error, href, base);

toUrlR

This function attempts construction of a URL object and returns a Result. Handles a related bug in Safari.

import { InvalidUrlError, toUrlR } from '@execonline-inc/url';
import { Result } from 'resulty';

const result: Result<InvalidUrlError, URL> = toUrlR('href', 'base');

toUrl

This function attempts construction of a URL object (via toUrlR) and returns a Maybe.

import { InvalidUrlError, toUrl } from '@execonline-inc/url';
import { Maybe } from 'maybeasy';

const result: Maybe<InvalidUrlError> = toUrl('href', 'base');

toUrlT

This function attempts construction of a URL object (via toUrlR) as a Task.

import { InvalidUrlError, toUrlT } from '@execonline-inc/url';
import Task from 'taskarian';

const result: Task<InvalidUrlError, URL> = toUrlT('href', 'base');

Readme

Keywords

none

Package Sidebar

Install

npm i @execonline-inc/url

Weekly Downloads

0

Version

8.2.0

License

MIT

Unpacked Size

12.4 kB

Total Files

8

Last publish

Collaborators

  • kofno