Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hapi/address

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/address - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

lib/decode.js

147

lib/index.d.ts

@@ -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 @@ };

6

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc