mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add definition for uri-template-lite (#43431)
* feat: add definition for uri-template-lite * style: fix * chore: fix
This commit is contained in:
parent
83fd63a9bb
commit
6f369959fd
15
types/uri-template-lite/index.d.ts
vendored
Normal file
15
types/uri-template-lite/index.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Type definitions for uri-template-lite 19.12
|
||||
// Project: https://github.com/litejs/uri-template-lite#readme
|
||||
// Definitions by: Vincenzo Chianese <https://github.com/DefinitelyTyped>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Minimum TypeScript Version: 3.0
|
||||
|
||||
export namespace URI {
|
||||
function expand(template: string, data: { [key: string]: unknown }): string;
|
||||
|
||||
class Template {
|
||||
constructor(template: string);
|
||||
expand: (data: { [key: string]: unknown }) => string;
|
||||
match: (template: string) => { [key: string]: string };
|
||||
}
|
||||
}
|
||||
23
types/uri-template-lite/tsconfig.json
Normal file
23
types/uri-template-lite/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"uri-template-lite-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/uri-template-lite/tslint.json
Normal file
1
types/uri-template-lite/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
10
types/uri-template-lite/uri-template-lite-tests.ts
Normal file
10
types/uri-template-lite/uri-template-lite-tests.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { URI } from 'uri-template-lite';
|
||||
|
||||
// Call `expand` directly
|
||||
const dataSet = { domain: "example.com", user: "fred", query: "mycelium" };
|
||||
URI.expand("http://{domain}/~{user}/foo{?query,number}", dataSet);
|
||||
|
||||
const template = new URI.Template("http://{domain}/~{user}/foo{?query,number}");
|
||||
template.expand(dataSet);
|
||||
template.match("http://example.com/~fred/foo?query=mycelium&number=3");
|
||||
template.match("http://other.com/?query=mycelium");
|
||||
Loading…
Reference in New Issue
Block a user