@hapi/address
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -0,1 +1,6 @@ | ||
/// <reference types="node" /> | ||
import * as Hoek from '@hapi/hoek'; | ||
export namespace domain { | ||
@@ -50,2 +55,3 @@ | ||
interface Allow { | ||
readonly allow: Set<string> | true; | ||
@@ -55,2 +61,3 @@ } | ||
interface Deny { | ||
readonly deny: Set<string>; | ||
@@ -111,1 +118,141 @@ } | ||
export const errors: Record<string, string>; | ||
export namespace ip { | ||
/** | ||
* Generates a regular expression used to validate IP addresses. | ||
* | ||
* @param options - optional settings. | ||
* | ||
* @returns an object with the regular expression and meta data. | ||
*/ | ||
function regex(options?: Options): Expression; | ||
interface Options { | ||
/** | ||
* The required CIDR mode. | ||
* | ||
* @default 'optional' | ||
*/ | ||
readonly cidr?: Cidr; | ||
/** | ||
* The allowed versions. | ||
* | ||
* @default ['ipv4', 'ipv6', 'ipvfuture'] | ||
*/ | ||
readonly version?: Version | Version[]; | ||
} | ||
type Cidr = 'optional' | 'required' | 'forbidden'; | ||
type Version = 'ipv4' | 'ipv6' | 'ipvfuture'; | ||
interface Expression { | ||
/** | ||
* The CIDR mode. | ||
*/ | ||
cidr: Cidr; | ||
/** | ||
* The raw regular expression string. | ||
*/ | ||
raw: string; | ||
/** | ||
* The regular expression. | ||
*/ | ||
regex: RegExp; | ||
/** | ||
* The array of versions allowed. | ||
*/ | ||
versions: Version[]; | ||
} | ||
} | ||
export namespace uri { | ||
/** | ||
* Faster version of decodeURIComponent() that does not throw. | ||
* | ||
* @param string - the URL string to decode. | ||
* | ||
* @returns the decoded string or null if invalid. | ||
*/ | ||
function decode(string: string): string | null; | ||
/** | ||
* Generates a regular expression used to validate URI addresses. | ||
* | ||
* @param options - optional settings. | ||
* | ||
* @returns an object with the regular expression and meta data. | ||
*/ | ||
function regex(options?: Options): Expression; | ||
type Options = Hoek.ts.XOR<Options.Options, Options.Relative>; | ||
namespace Options { | ||
interface Query { | ||
/** | ||
* Allow the use of [] in query parameters. | ||
* | ||
* @default false | ||
*/ | ||
readonly allowQuerySquareBrackets?: boolean; | ||
} | ||
interface Relative extends Query { | ||
/** | ||
* Requires the URI to be relative. | ||
* | ||
* @default false | ||
*/ | ||
readonly relativeOnly?: boolean; | ||
} | ||
interface Options extends Query { | ||
/** | ||
* Allow relative URIs. | ||
* | ||
* @default false | ||
*/ | ||
readonly allowRelative?: boolean; | ||
/** | ||
* Capture domain segment ($1). | ||
* | ||
* @default false | ||
*/ | ||
readonly domain?: boolean; | ||
/** | ||
* The allowed URI schemes. | ||
*/ | ||
readonly scheme?: Scheme | Scheme[]; | ||
} | ||
type Scheme = string | RegExp; | ||
} | ||
interface Expression { | ||
/** | ||
* The raw regular expression string. | ||
*/ | ||
raw: string; | ||
/** | ||
* The regular expression. | ||
*/ | ||
regex: RegExp; | ||
} | ||
} |
'use strict'; | ||
const Decode = require('./decode'); | ||
const Domain = require('./domain'); | ||
const Email = require('./email'); | ||
const Errors = require('./errors'); | ||
const Ip = require('./ip'); | ||
const Tlds = require('./tlds'); | ||
const Uri = require('./uri'); | ||
@@ -42,2 +45,9 @@ | ||
} | ||
}, | ||
ip: { | ||
regex: Ip.regex | ||
}, | ||
uri: { | ||
decode: Decode.decode, | ||
regex: Uri.regex | ||
} | ||
@@ -44,0 +54,0 @@ }; |
{ | ||
"name": "@hapi/address", | ||
"description": "Email address and domain validation", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"repository": "git://github.com/hapijs/address", | ||
@@ -17,3 +17,5 @@ "main": "lib/index.js", | ||
], | ||
"dependencies": {}, | ||
"dependencies": { | ||
"@hapi/hoek": "^8.4.0" | ||
}, | ||
"devDependencies": { | ||
@@ -20,0 +22,0 @@ "@hapi/code": "7.x.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56916
13
2301
1
+ Added@hapi/hoek@^8.4.0
+ Added@hapi/hoek@8.5.1(transitive)