mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(gravatar): missing 1.8 version features (#42843)
- correct DT header and package version
- `profile_url` method
- `cdn` options property
- `forceProtocol` aligned with documented `protocol`
- adding new method resulted in module shape correction (export `url`
and `profile_url` directly from the module
- tests updated
- update tslint config
https://github.com/emerleite/node-gravatar#usage
https://github.com/emerleite/node-gravatar#examples
dd76e57087/Changelog.md (180)
Thanks!
This commit is contained in:
parent
1c9e1cbfbb
commit
5f2ca8c55a
@ -1,16 +1,21 @@
|
||||
|
||||
|
||||
import gravatar = require('gravatar');
|
||||
|
||||
gravatar.url("email@example.com");
|
||||
gravatar.url("email@example.com", { s: "200", r: "pg", d: "404" });
|
||||
gravatar.url("email@example.com", { size: "200", r: "pg", d: "404" });
|
||||
gravatar.url("email@example.com", { s: "200" });
|
||||
gravatar.url("email@example.com", { default: "404" });
|
||||
gravatar.url("email@example.com", { s: "200", rating: "pg", d: "404" }, true);
|
||||
gravatar.url("email@example.com", { s: "200", r: "pg", default: "404" }, false);
|
||||
gravatar.url("email@example.com", { d: "404" }, false);
|
||||
gravatar.url("email@example.com", { forcedefault: "y" }, false);
|
||||
gravatar.url("email@example.com", { f: "y" });
|
||||
gravatar.url("email@example.com", { protocol: "https" });
|
||||
gravatar.url("email@example.com", { format: "xml" });
|
||||
gravatar.url('email@example.com');
|
||||
gravatar.url('email@example.com', { s: '200', r: 'pg', d: '404' });
|
||||
gravatar.url('email@example.com', { size: '200', r: 'pg', d: '404' });
|
||||
gravatar.url('email@example.com', { s: '200' });
|
||||
gravatar.url('email@example.com', { default: '404' });
|
||||
gravatar.url('email@example.com', { s: '200', rating: 'pg', d: '404' }, true);
|
||||
gravatar.url('email@example.com', { s: '200', r: 'pg', default: '404' }, false);
|
||||
gravatar.url('email@example.com', { d: '404' }, false);
|
||||
gravatar.url('email@example.com', { forcedefault: 'y' }, false);
|
||||
gravatar.url('email@example.com', { f: 'y' });
|
||||
gravatar.url('email@example.com', { protocol: 'https' });
|
||||
gravatar.url('email@example.com', { format: 'xml' });
|
||||
gravatar.profile_url('email@example.com');
|
||||
gravatar.profile_url('email@example.com', {});
|
||||
gravatar.profile_url('email@example.com', {}, true);
|
||||
gravatar.profile_url('emerleite@gmail.com', { protocol: 'https' });
|
||||
gravatar.profile_url('emerleite@gmail.com', { protocol: 'http', format: 'qr' });
|
||||
gravatar.url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' });
|
||||
gravatar.profile_url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' });
|
||||
|
||||
48
types/gravatar/index.d.ts
vendored
48
types/gravatar/index.d.ts
vendored
@ -1,23 +1,35 @@
|
||||
// Type definitions for gravatar v1.8.0
|
||||
// Type definitions for gravatar 1.8
|
||||
// Project: https://github.com/emerleite/node-gravatar
|
||||
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
|
||||
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace GravatarModule {
|
||||
type Options = {
|
||||
d?: string
|
||||
default?: string
|
||||
f?: string
|
||||
forcedefault?: string
|
||||
format?: string
|
||||
protocol?: string
|
||||
r?: string
|
||||
rating?: string
|
||||
s?: string
|
||||
size?: string
|
||||
}
|
||||
|
||||
function url(email: string, options?: Options, forceProtocol?: boolean): string;
|
||||
export interface Options {
|
||||
cdn?: string;
|
||||
d?: string;
|
||||
default?: string;
|
||||
f?: string;
|
||||
forcedefault?: string;
|
||||
format?: string;
|
||||
protocol?: string;
|
||||
r?: string;
|
||||
rating?: string;
|
||||
s?: string;
|
||||
size?: string;
|
||||
}
|
||||
|
||||
export = GravatarModule;
|
||||
/**
|
||||
* @param email - The gravatar email
|
||||
* @param [options] - Query string options
|
||||
* @param [protocol] - Define if will use no protocol, http or https gravatar URL.
|
||||
* Default is 'undefined', which generates URLs without protocol.
|
||||
* True to force https and false to force http
|
||||
*/
|
||||
export function url(email: string, options?: Options, protocol?: boolean): string;
|
||||
/**
|
||||
* @param email - The gravatar email
|
||||
* @param [options] - Query string options
|
||||
* @param [protocol] - Define if will use no protocol, http or https gravatar URL.
|
||||
* Default is 'undefined', which generates URLs without protocol.
|
||||
* True to force https and false to force http
|
||||
*/
|
||||
export function profile_url(email: string, options?: Options, protocol?: boolean): string;
|
||||
|
||||
@ -1,14 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"callable-types": false,
|
||||
"dt-header": false,
|
||||
"export-just-namespace": false,
|
||||
"interface-over-type-literal": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"prefer-method-signature": false,
|
||||
"semicolon": false,
|
||||
"trim-file": false
|
||||
}
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user