network-avatar-picker
Advanced tools
Comparing version 1.3.8 to 1.3.9
@@ -7,2 +7,3 @@ 'use strict'; | ||
var github = require('./providers/github'); | ||
var gmail = require('./providers/gmail'); | ||
var instagram = require('./providers/instagram'); | ||
@@ -19,2 +20,3 @@ var tumblr = require('./providers/tumblr'); | ||
this.github = github.init(); | ||
this.gmail = gmail.init(); | ||
this.instagram = instagram.init(); | ||
@@ -21,0 +23,0 @@ this.tumblr = tumblr.init(); |
'use strict'; | ||
var crypto = require('crypto'); | ||
var FACEBOOK = 'facebook'; | ||
@@ -10,3 +12,9 @@ var GITHUB = 'github'; | ||
var YOUTUBE = 'youtube'; | ||
var GMAIL = 'gmail'; | ||
var GRAVATAR = 'gravatar'; | ||
var md5 = function md5(input) { | ||
return crypto.createHash('md5').update(input).digest('hex'); | ||
}; | ||
module.exports = { | ||
@@ -19,3 +27,6 @@ FACEBOOK: FACEBOOK, | ||
VIMEO: VIMEO, | ||
YOUTUBE: YOUTUBE | ||
YOUTUBE: YOUTUBE, | ||
GMAIL: GMAIL, | ||
GRAVATAR: GRAVATAR, | ||
md5: md5 | ||
}; |
@@ -12,4 +12,26 @@ 'use strict'; | ||
function validateEmail(email) { | ||
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||
if (!email) { | ||
throw new Error('Email required as input'); | ||
} | ||
if (!re.test(email)) { | ||
throw new Error('Add a valid email'); | ||
} | ||
} | ||
function validateGmail(email) { | ||
if (!email) { | ||
throw new Error('Gmail required as input'); | ||
} | ||
validateEmail(email); | ||
if (!/@gmail\.com$/.test(email)) { | ||
throw new Error('Add a valid gmail'); | ||
} | ||
} | ||
module.exports = { | ||
validateUsernameInput: validateUsernameInput | ||
validateUsernameInput: validateUsernameInput, | ||
validateEmail: validateEmail, | ||
validateGmail: validateGmail | ||
}; |
{ | ||
"name": "network-avatar-picker", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"description": "A picker for user's networks profile image.", | ||
@@ -31,3 +31,4 @@ "main": "lib/index.js", | ||
"youtube", | ||
"vimeo" | ||
"vimeo", | ||
"gmail" | ||
], | ||
@@ -34,0 +35,0 @@ "license": "ISC", |
# network-avatar-picker | ||
> A npm module that returns a user's avatar from his social networks as Buffer or as URL. You can choose among Facebook, Twitter, Instagram, Tumblr, Vimeo, Github and Youtube provider. Then, you just need to pass a username **without the need of token or API keys** and retrieve user's social network profile picture! | ||
> A npm module that returns a user's avatar from his social networks as Buffer or as URL. You can choose among Facebook, Twitter, Instagram, Tumblr, Vimeo, Github, Gmail and Youtube provider. Then, you just need to pass a username **without the need of token or API keys** and retrieve user's social network profile picture! | ||
@@ -12,2 +12,3 @@ | ||
- Github | ||
- Gmail | ||
@@ -37,2 +38,4 @@ - Tumblr | ||
**Get avatar as Buffer:** | ||
- `avatarPicker.facebook.getAvatar(username)` | ||
- `avatarPicker.twitter.getAvatar(username)` | ||
@@ -42,8 +45,9 @@ - `avatarPicker.instagram.getAvatar(username)` | ||
- `avatarPicker.vimeo.getAvatar(username)` | ||
- `avatarPicker.facebook.getAvatar(username)` | ||
- `avatarPicker.github.getAvatar(username)` | ||
- `avatarPicker.youtube.getAvatar(username)` | ||
- `avatarPicker.gmail.getAvatar(email)` | ||
**Get avatar as URL:** | ||
- `avatarPicker.facebook.getAvatarUrl(username)` | ||
- `avatarPicker.twitter.getAvatarUrl(username)` | ||
@@ -53,5 +57,5 @@ - `avatarPicker.instagram.getAvatarUrl(username)` | ||
- `avatarPicker.vimeo.getAvatarUrl(username)` | ||
- `avatarPicker.facebook.getAvatarUrl(username)` | ||
- `avatarPicker.github.getAvatarUrl(username)` | ||
- `avatarPicker.youtube.getAvatarUrl(username)` | ||
- `avatarPicker.gmail.getAvatarUrl(email)` | ||
@@ -58,0 +62,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28426
17
317
138