Add types for ip-regex 2.0.0 (#14069)

This commit is contained in:
Daniel Perez Alvarez
2017-01-17 21:08:15 +01:00
committed by Mohamed Hegazy
parent 60e56c268f
commit cd116a2d29
4 changed files with 40 additions and 0 deletions

12
ip-regex/index.d.ts vendored Normal file
View 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;

View 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
View 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
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }