Merge pull request #31376 from BendingBender/get-urls

Add types for get-urls
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 10:06:02 -08:00
committed by GitHub
4 changed files with 57 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import getUrls = require('get-urls');
const text =
'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';
// $ExpectType Set<string>
getUrls(text);
// $ExpectType Set<string>
getUrls(text, { extractFromQueryString: true });
// $ExpectType Set<string>
getUrls(text, { exclude: ['foo'] });
// $ExpectType Set<string>
getUrls(text, { defaultProtocol: 'ftp' });
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for get-urls 8.0
// Project: https://github.com/sindresorhus/get-urls#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Options as NormalizeUrlOptions } from 'normalize-url';
export = getUrls;
declare function getUrls(text: string, options?: getUrls.Options): Set<string>;
declare namespace getUrls {
interface Options extends NormalizeUrlOptions {
extractFromQueryString?: boolean;
exclude?: string[];
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"get-urls-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }