@gravatar/js
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Gravatar

Typescript friendly Gravatar library to generate gravatar image links from email.

Minimal Dependency: No node or browser dependency, so will work seamlessly in node, browser or electron .

Installation

yarn add @gravatar/js

or

npm i @gravatar/js --save

Parameters

Param Type Default Description
email string none Email address of the user to generate gravatar
md5Hash string Optional: MD5 hash of the email, either email or MD5 hash is required
size number 80 Optional: The size of the image to be displayed. Should be from 1 to 2048
defaultImage any of '404', 'mp', 'identicon' , 'monsterid' , 'wavatar' , 'retro', 'robohash', 'blank';
protocol http or https http Protocol for the gravatar image url.

Usage

Import

import the library

ES5

const Gravatar = require('@gravatar/js')

ES6

import JsGravatar from '@gravatar/js'

Call the method with its options.

const userProfilePic = Gravatar({ email: 'example@example.com' })

const userProfilePic = Gravatar({ email: 'example@example.com', size: 10, protocol: 'https' })

License

Copyright © 2020 Vazra, MIT License

Package Sidebar

Install

npm i @gravatar/js

Weekly Downloads

448

Version

1.1.1

License

MIT

Unpacked Size

10.3 kB

Total Files

15

Last publish

Collaborators

  • vazra