mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 16:50:15 +00:00
28
types/original/index.d.ts
vendored
Normal file
28
types/original/index.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for original 1.0
|
||||
// Project: https://github.com/unshiftio/original
|
||||
// Definitions by: Wayne Carson <https://github.com/wcarson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/**
|
||||
* Transform an URL to a valid origin value.
|
||||
*
|
||||
* @param url URL to transform to it's origin.
|
||||
* @returns The origin.
|
||||
* @api public
|
||||
*/
|
||||
declare function origin(url: string | object | { protocol: string, host: string }): string;
|
||||
|
||||
declare namespace origin {
|
||||
/**
|
||||
* Check if the origins are the same.
|
||||
*
|
||||
* @param a URL or origin of a.
|
||||
* @param b URL or origin of b.
|
||||
* @returns true if origins are the same, false otherwise
|
||||
* @api public
|
||||
*/
|
||||
function same(a: string, b: string): boolean;
|
||||
}
|
||||
|
||||
export = origin;
|
||||
7
types/original/original-tests.ts
Normal file
7
types/original/original-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import origin = require('original');
|
||||
|
||||
// $ExpectType string
|
||||
origin('https://google.com/gmail');
|
||||
|
||||
// $ExpectType boolean
|
||||
origin.same('https://google.com/gmail', 'https://google.com:443/gmail');
|
||||
23
types/original/tsconfig.json
Normal file
23
types/original/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"original-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/original/tslint.json
Normal file
3
types/original/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user