mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 08:40:12 +00:00
Add types for ip-regex 2.0.0 (#14069)
This commit is contained in:
committed by
Mohamed Hegazy
parent
60e56c268f
commit
cd116a2d29
12
ip-regex/index.d.ts
vendored
Normal file
12
ip-regex/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for ip-regex 2.0
|
||||
// Project: https://github.com/sindresorhus/ip-regex
|
||||
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** Regular expression for matching IP addresses (IPv4 & IPv6). */
|
||||
declare function ipRegex(options?: {
|
||||
/** Only match an exact string. Useful with RegExp#test to check if a string is an IP address. */
|
||||
exact?: boolean;
|
||||
}): RegExp;
|
||||
|
||||
export = ipRegex;
|
||||
7
ip-regex/ip-regex-tests.ts
Normal file
7
ip-regex/ip-regex-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import ipRegex = require('ip-regex');
|
||||
|
||||
ipRegex().test('unicorn 192.168.0.1');
|
||||
|
||||
ipRegex({exact: true}).test('unicorn 192.168.0.1');
|
||||
|
||||
'unicorn 192.168.0.1 cake 1:2:3:4:5:6:7:8 rainbow'.match(ipRegex());
|
||||
20
ip-regex/tsconfig.json
Normal file
20
ip-regex/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ip-regex-tests.ts"
|
||||
]
|
||||
}
|
||||
1
ip-regex/tslint.json
Normal file
1
ip-regex/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user