mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
add types for oembed-parser (#30633)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
fc8b7956f9
commit
4b2af06acd
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for oembed-parser 1.2
|
||||
// Project: https://www.npmjs.com/package/oembed-parser
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function extract(url: string): Promise<OembedData>;
|
||||
|
||||
export function hasProvider(url: string): boolean;
|
||||
|
||||
export interface OembedData {
|
||||
type: string;
|
||||
version: string;
|
||||
html: string;
|
||||
provider_url: string;
|
||||
provider_name: string;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { extract, hasProvider, OembedData } from "oembed-parser";
|
||||
|
||||
const url = "https://www.youtube.com/watch?v=8jPQjjsBbIc";
|
||||
|
||||
extract(url).then(data => {
|
||||
const parsedData: OembedData = data;
|
||||
});
|
||||
|
||||
const providerExists: boolean = hasProvider(url);
|
||||
@@ -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",
|
||||
"oembed-parser-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user