embeds
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -31,3 +31,3 @@ 'use strict'; | ||
var allowed = [[/(https?:)?\/\/(www\.)?instagram\.com\/p\/([A-Za-z0-9_-]+)/, function (match) { | ||
var allowed = [[/(https?:)?\/\/(www\.)?instagram\.com\/p\/([\w.-]+)/, function (match) { | ||
var id = match[3]; | ||
@@ -40,3 +40,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?giphy\.com\/embed\/([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?giphy\.com\/embed\/([\w.-]+)/, function (match) { | ||
var id = match[3]; | ||
@@ -49,3 +49,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?facebook\.com\/([A-Za-z0-9_-]+)\/(videos|posts)\/([0-9]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?facebook\.com\/([\w.-]+)\/(videos|posts)\/([0-9]+)/, function (match) { | ||
var user = match[3]; | ||
@@ -62,3 +62,3 @@ var type = match[4]; | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?twitter\.com\/([A-Za-z0-9_-]+)\/status\/([0-9]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?twitter\.com\/([\w.-]+)\/status\/([0-9]+)/, function (match) { | ||
var user = match[3]; | ||
@@ -72,3 +72,3 @@ var id = match[4]; | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?youtube\.com\/(embed\/|watch\?v=)([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?youtube\.com\/(embed\/|watch\?v=)([\w.-]+)/, function (match) { | ||
var id = match[4]; | ||
@@ -80,3 +80,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?youtu\.be\/([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?youtu\.be\/([\w.-]+)/, function (match) { | ||
var id = match[3]; | ||
@@ -88,3 +88,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/embed\.tumblr\.com\/embed\/post\/([A-Za-z0-9_-]+)\/([0-9]+)/, function (match) { | ||
}], [/(https?:)?\/\/embed\.tumblr\.com\/embed\/post\/([\w.-]+)\/([0-9]+)/, function (match) { | ||
var key = match[2]; | ||
@@ -97,3 +97,3 @@ var id = match[3]; | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?vine\.co\/v\/([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?vine\.co\/v\/([\w.-]+)/, function (match) { | ||
var id = match[3]; | ||
@@ -105,3 +105,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/(www\.)?imgur\.com\/(gallery\/)?([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.)?imgur\.com\/(gallery\/)?([\w.-]+)/, function (match) { | ||
var id = match[4]; | ||
@@ -113,3 +113,3 @@ return { | ||
}; | ||
}], [/(https?:)?\/\/(www\.|w\.)?graphiq\.com\/(wlp|w)\/([A-Za-z0-9_-]+)/, function (match) { | ||
}], [/(https?:)?\/\/(www\.|w\.)?graphiq\.com\/(wlp|w)\/([\w.-]+)/, function (match) { | ||
var id = match[4]; | ||
@@ -116,0 +116,0 @@ return { |
const allowed = [ | ||
[/(https?:)?\/\/(www\.)?instagram\.com\/p\/([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?instagram\.com\/p\/([\w.-]+)/, match => { | ||
const id = match[3]; | ||
@@ -11,3 +11,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/(www\.)?giphy\.com\/embed\/([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?giphy\.com\/embed\/([\w.-]+)/, match => { | ||
const id = match[3]; | ||
@@ -21,3 +21,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/(www\.)?facebook\.com\/([A-Za-z0-9_-]+)\/(videos|posts)\/([0-9]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?facebook\.com\/([\w.-]+)\/(videos|posts)\/([0-9]+)/, match => { | ||
const user = match[3]; | ||
@@ -35,3 +35,3 @@ const type = match[4]; | ||
}], | ||
[/(https?:)?\/\/(www\.)?twitter\.com\/([A-Za-z0-9_-]+)\/status\/([0-9]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?twitter\.com\/([\w.-]+)\/status\/([0-9]+)/, match => { | ||
const user = match[3]; | ||
@@ -46,3 +46,3 @@ const id = match[4]; | ||
}], | ||
[/(https?:)?\/\/(www\.)?youtube\.com\/(embed\/|watch\?v=)([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?youtube\.com\/(embed\/|watch\?v=)([\w.-]+)/, match => { | ||
const id = match[4]; | ||
@@ -55,3 +55,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/(www\.)?youtu\.be\/([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?youtu\.be\/([\w.-]+)/, match => { | ||
const id = match[3]; | ||
@@ -64,3 +64,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/embed\.tumblr\.com\/embed\/post\/([A-Za-z0-9_-]+)\/([0-9]+)/, match => { | ||
[/(https?:)?\/\/embed\.tumblr\.com\/embed\/post\/([\w.-]+)\/([0-9]+)/, match => { | ||
const key = match[2]; | ||
@@ -74,3 +74,3 @@ const id = match[3]; | ||
}], | ||
[/(https?:)?\/\/(www\.)?vine\.co\/v\/([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?vine\.co\/v\/([\w.-]+)/, match => { | ||
const id = match[3]; | ||
@@ -83,3 +83,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/(www\.)?imgur\.com\/(gallery\/)?([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.)?imgur\.com\/(gallery\/)?([\w.-]+)/, match => { | ||
const id = match[4]; | ||
@@ -92,3 +92,3 @@ return { | ||
}], | ||
[/(https?:)?\/\/(www\.|w\.)?graphiq\.com\/(wlp|w)\/([A-Za-z0-9_-]+)/, match => { | ||
[/(https?:)?\/\/(www\.|w\.)?graphiq\.com\/(wlp|w)\/([\w.-]+)/, match => { | ||
const id = match[4]; | ||
@@ -95,0 +95,0 @@ return { |
{ | ||
"name": "embeds", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"description": "Parse & render embeds", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -382,1 +382,24 @@ import test from 'ava'; | ||
}); | ||
test('facebook allow periods in username', t => { | ||
const expected = { | ||
type: 'facebook', | ||
embedAs: 'video', | ||
user: 'rick.morty', | ||
url: 'https://www.facebook.com/rick.morty/videos/1337', | ||
id: '1337' | ||
}; | ||
const actual = parseInput('https://www.facebook.com/rick.morty/videos/1337'); | ||
t.deepEqual(expected, actual); | ||
}); | ||
test('twitter allow periods in username', t => { | ||
const expected = { | ||
type: 'twitter', | ||
url: 'https://twitter.com/rick.morty/status/42', | ||
user: 'rick.morty', | ||
id: '42' | ||
}; | ||
const actual = parseInput('https://twitter.com/rick.morty/status/42'); | ||
t.deepEqual(expected, actual); | ||
}); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
102922
2546
1