From f230764afd5e0f21f1aaf7407f7b0465df1f4b78 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Mon, 22 Feb 2016 19:55:20 +0200 Subject: [PATCH] Add typings for gravatar --- gravatar/gravatar-tests.ts | 14 ++++++++++++++ gravatar/gravatar.d.ts | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 gravatar/gravatar-tests.ts create mode 100644 gravatar/gravatar.d.ts diff --git a/gravatar/gravatar-tests.ts b/gravatar/gravatar-tests.ts new file mode 100644 index 000000000..d0edb4e64 --- /dev/null +++ b/gravatar/gravatar-tests.ts @@ -0,0 +1,14 @@ +/// + +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" }); diff --git a/gravatar/gravatar.d.ts b/gravatar/gravatar.d.ts new file mode 100644 index 000000000..42ef46bb6 --- /dev/null +++ b/gravatar/gravatar.d.ts @@ -0,0 +1,23 @@ +// Type definitions for gravatar v1.4.0 +// Project: https://github.com/emerleite/node-gravatar +// Definitions by: Denis Sokolov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module GravatarModule { + type Options = { + d?: string + default?: string + f?: string + forcedefault?: string + r?: string + rating?: string + s?: string + size?: string + } + + function url(email: string, options?: Options, forceProtocol?: boolean): string; +} + +declare module "gravatar" { + export = GravatarModule; +}