abolish
Version:
A javascript object validator.
34 lines (33 loc) • 829 B
TypeScript
import type { AbolishValidator } from "../../src/types";
type AllowOrBlock = {
allow?: string[];
block?: string[];
};
type UrlOption = boolean | {
hostname?: AllowOrBlock;
protocol?: AllowOrBlock;
};
declare const _default: AbolishValidator;
export = _default;
declare module "../../src/validator" {
namespace AvailableValidators {
interface Options {
url: UrlOption;
}
}
}
/**
* ----------------------------------------------------
* REGEX PAST TRIALS
* ----------------------------------------------------
*/
/**
* First Regexp from https://mathiasbynens.be/demo/url-regex
* Almost perfect
* Does not allow ports.
*/
/**
* Second Regexp from https://www.regextester.com/96504
* Allows some urls that we can't consider valid
* e.g "http://" "127.0.0.1 a space"
*/