Socket
Socket
Sign inDemoInstall

embeds

Package Overview
Dependencies
23
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.10.0 to 2.10.1

8

dist/types/facebook.js

@@ -44,4 +44,4 @@ 'use strict';

var aElms = elm.getElementsByTagName('a') || [];
var user = aElms[0] ? aElms[0].childNodes[0].data : '';
var date = aElms[1] ? aElms[1].childNodes[0].data : '';
var user = aElms[0] && aElms[0].childNodes[0] ? aElms[0].childNodes[0].data : '';
var date = aElms[1] && aElms[1].childNodes[0] ? aElms[1].childNodes[0].data : '';

@@ -55,3 +55,3 @@ return { embedAs: embedAs, type: type, url: url, text: text, date: date, user: user };

var aElms = elm.getElementsByTagName('a') || [];
var headline = aElms[0] ? aElms[0].childNodes[0].data : '';
var headline = aElms[0] && aElms[0].childNodes[0] ? aElms[0].childNodes[0].data : '';
var blockquoteElm = elm.getElementsByTagName('blockquote')[0];

@@ -61,3 +61,3 @@ var date = blockquoteElm ? (0, _lodash2.default)(blockquoteElm.childNodes).data.replace(' on ', '') : '';

url: aElms[1] && aElms[1].getAttribute('href') || '',
name: aElms[1] && aElms[1].childNodes[0].data || ''
name: aElms[1] && aElms[1].childNodes[0] && aElms[1].childNodes[0].data || ''
};

@@ -64,0 +64,0 @@ var pElm = elm.getElementsByTagName('p')[0];

@@ -19,4 +19,4 @@ const type = 'facebook';

const aElms = elm.getElementsByTagName('a') || [];
const user = aElms[0] ? aElms[0].childNodes[0].data : '';
const date = aElms[1] ? aElms[1].childNodes[0].data : '';
const user = aElms[0] && aElms[0].childNodes[0] ? aElms[0].childNodes[0].data : '';
const date = aElms[1] && aElms[1].childNodes[0] ? aElms[1].childNodes[0].data : '';

@@ -30,3 +30,3 @@ return {embedAs, type, url, text, date, user};

const aElms = elm.getElementsByTagName('a') || [];
const headline = aElms[0] ? aElms[0].childNodes[0].data : '';
const headline = aElms[0] && aElms[0].childNodes[0] ? aElms[0].childNodes[0].data : '';
const blockquoteElm = elm.getElementsByTagName('blockquote')[0];

@@ -36,3 +36,3 @@ const date = blockquoteElm ? last(blockquoteElm.childNodes).data.replace(' on ', '') : '';

url: aElms[1] && aElms[1].getAttribute('href') || '',
name: aElms[1] && aElms[1].childNodes[0].data || ''
name: aElms[1] && aElms[1].childNodes[0] && aElms[1].childNodes[0].data || ''
};

@@ -39,0 +39,0 @@ const pElm = elm.getElementsByTagName('p')[0];

{
"name": "embeds",
"version": "2.10.0",
"version": "2.10.1",
"description": "Parse & render embeds",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import test from './tape-wrapper';
import {parseInput} from '../lib';
import tsml from 'tsml';
import {render, parse as _parse} from '../lib';
import {renderString, tree} from 'deku';
import queryDom from 'query-dom';
const parse = process.browser
? (str) => {
const node = document.createElement('div');
node.innerHTML = str;
return _parse(node.childNodes);
}
: str => _parse(queryDom(str));
const renderAndParse = input =>
parse(renderString(tree(render(input))));
test('parse invalid input', t => {

@@ -166,2 +181,7 @@ t.is(parseInput(), null);

t.equals(
renderAndParse(expectedVideo).url,
expectedVideo.url
);
t.deepEqual(parseInput(postCode), expectedPost);

@@ -190,2 +210,7 @@ t.deepEqual(

t.equals(
renderAndParse(expectedPost).url,
expectedPost.url
);
const expectedPagePhoto = {

@@ -219,2 +244,7 @@ type: 'facebook',

t.equals(
renderAndParse(expectedPagePhoto).url,
expectedPagePhoto.url
);
const expectedPhoto = {

@@ -239,2 +269,7 @@ type: 'facebook',

expectedPhoto);
t.equals(
renderAndParse(expectedPhoto).url,
expectedPhoto.url
);
});

@@ -271,2 +306,7 @@

t.deepEqual(parseInput('//youtu.be/I7IdS-PbEgI'), expected);
t.equals(
renderAndParse(expected).youtubeId,
expected.youtubeId
);
});

@@ -322,2 +362,7 @@

);
t.equals(
renderAndParse(expected).url,
expected.url
);
});

@@ -355,2 +400,7 @@

);
t.equals(
renderAndParse(expected).url,
expected.url
);
});

@@ -383,2 +433,7 @@

t.deepEqual(parseInput('//vine.co/v/iHTTDHz6Z2v/embed/simple'), expected);
t.deepEqual(
renderAndParse(expected),
expected
);
});

@@ -385,0 +440,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc