forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Merge PR DefinitelyTyped#49305 feat(js-gravatar): new definition by @…
…peterblazejewicz - definition file - tests https://github.com/chukwumaijem/js-gravatar#js-gravatar Thanks!
- Loading branch information
1 parent
5ed1775
commit cdcf3ff
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Type definitions for js-gravatar 1.1 | ||
// Project: https://github.com/chukwumaijem/js-gravatar#readme | ||
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/** | ||
* JS Gravatar | ||
* {@link https://github.com/chukwumaijem/js-gravatar#js-gravatar} | ||
*/ | ||
declare function jsGravatar(options?: jsGravatar.Options): string; | ||
|
||
declare namespace jsGravatar { | ||
interface Options { | ||
/** | ||
* The size of the image to be displayed. Should be from 1 to 2048 | ||
*/ | ||
size?: number; | ||
/** | ||
* What image should be used if email does not have a gravatar | ||
*/ | ||
defaultImage?: '404' | 'mp' | 'identicon' | 'monsterid' | 'wavatar' | 'retro' | 'robohash' | 'blank'; | ||
/** | ||
* Email address of the user to generate gravatar for | ||
*/ | ||
email: string; | ||
/** | ||
* Optional: MD5 hash of the email above. | ||
* If email is provided, md5hash will be ignored. If neither email nor md5hash is provided, the library will throw en error | ||
*/ | ||
md5Hash?: string; | ||
} | ||
|
||
function buildQueryStringFromOptions(options: Options): string; | ||
function validateOptions(options?: Options): void; | ||
} | ||
|
||
export as namespace jsGravatar; | ||
|
||
export = jsGravatar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import JsGravatar = require('js-gravatar'); | ||
import { buildQueryStringFromOptions, validateOptions } from 'js-gravatar'; | ||
|
||
// $ExpectType string | ||
JsGravatar({ email: 'user@email.com', size: 10, defaultImage: 'identicon' }); | ||
// $ExpectType string | ||
buildQueryStringFromOptions({ email: 'user@email.com', defaultImage: 'monsterid' }); | ||
// $ExpectType void | ||
validateOptions({ email: 'user@email.com', size: 10, defaultImage: 'identicon' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
"js-gravatar-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |