Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transloadit/enrich-tweet

Package Overview
Dependencies
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transloadit/enrich-tweet - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

22

dist/enrichTweet.d.ts

@@ -1,1 +0,21 @@

export default function enrichTweet(tweet: $TSFixMe, unshorten?: boolean): Promise<any>;
type Tweet = {
full_text: string;
entities?: {
urls: {
display_url: string;
url: string;
expanded_url: string;
}[];
};
extended_entities?: {
media: {
display_url: string;
url: string;
media_url: string;
media_url_https: string;
expanded_url: string;
}[];
};
};
export default function enrichTweet(tweet: Tweet, unshorten?: boolean): Promise<string | undefined>;
export {};

31

dist/enrichTweet.js

@@ -18,19 +18,18 @@ "use strict";

const get_urls_1 = __importDefault(require("get-urls"));
function enrichTweet(tweet, unshorten = true) {
function tryUnshorten(url, unshorten) {
return __awaiter(this, void 0, void 0, function* () {
function tryUnshorten(url) {
return __awaiter(this, void 0, void 0, function* () {
if (!unshorten)
return url;
try {
return yield (0, tall_1.tall)(url);
}
catch (err) {
return url;
}
});
if (!unshorten)
return url;
try {
return yield (0, tall_1.tall)(url);
}
if (!tweet) {
return tweet;
catch (err) {
return url;
}
});
}
function enrichTweet(tweet, unshorten = true) {
return __awaiter(this, void 0, void 0, function* () {
if (!tweet)
return;
let text = tweet.full_text;

@@ -40,3 +39,3 @@ if (tweet.entities && tweet.entities.urls.length) {

for (const subUrl1 of subUrls) {
const unshortened = yield tryUnshorten(subUrl1.expanded_url);
const unshortened = yield tryUnshorten(subUrl1.expanded_url, unshorten);
const friends1 = [subUrl1.display_url, subUrl1.url, subUrl1.expanded_url];

@@ -67,3 +66,3 @@ for (const friend1 of friends1) {

}
const unshortened3 = yield tryUnshorten(subUrl3);
const unshortened3 = yield tryUnshorten(subUrl3, unshorten);
text = text.replace(`${subUrl3}`, `${unshortened3}`);

@@ -70,0 +69,0 @@ }

{
"name": "@transloadit/enrich-tweet",
"license": "AGPL-3.0-only",
"version": "0.1.3",
"version": "0.1.4",
"publishConfig": {

@@ -23,3 +23,3 @@ "access": "public"

"scripts": {
"tsc": "tsc",
"tsc": "tsc --build --clean && tsc --build",
"test": "echo \"Error: run tests from root\" && exit 1"

@@ -37,3 +37,3 @@ },

},
"gitHead": "5c487499031f01adcc6869b3a0b7a4ac3d7d21c0"
"gitHead": "b9159b6f037336d9325656c35b9b15023d5c1ce7"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc