New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bufferapp/publish-utils

Package Overview
Dependencies
Maintainers
11
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufferapp/publish-utils - npm Package Compare versions

Comparing version 0.5.35 to 0.6.0

15

linkParsing.js
const twitter = require('./twitter.text');
const makeUnicodeAwareIndexUnaware = (str, i) => Array.from(str).slice(0, i).join('').length;
module.exports = {
parseFacebookEntities: (postText, entities) => {
if (!entities) return [];
return entities.map(({ url, text, indices }) => ({
displayString: text,
indices: [
makeUnicodeAwareIndexUnaware(postText, indices[0]),
makeUnicodeAwareIndexUnaware(postText, indices[1]),
],
rawString: text,
url,
}));
},
parseTwitterLinks: text =>

@@ -5,0 +20,0 @@ twitter.extractEntitiesWithIndices(text)

2

package.json
{
"name": "@bufferapp/publish-utils",
"version": "0.5.35",
"version": "0.6.0",
"description": "Misc. utils for dates, parsing, etc.",

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

const { getDateString } = require('./date');
const { parseTwitterLinks } = require('./linkParsing');
const {
parseTwitterLinks,
parseFacebookEntities,
} = require('./linkParsing');

@@ -75,2 +78,10 @@ const getImageUrls = (post) => {

}
const canHaveLinks = post.profile_service === 'twitter' || post.profile_service === 'facebook';
const links =
parseTwitterLinks(text)
.concat(post.profile_service === 'facebook' ? parseFacebookEntities(text, post.entities) : [])
.sort(({ indices: [startIdxA] }, { indices: [startIdxB] }) => startIdxA - startIdxB);
return {

@@ -84,3 +95,3 @@ day: post.day,

imageUrls: getImageUrls(post),
links: parseTwitterLinks(text),
links: canHaveLinks ? links : [],
profileTimezone: post.profile_timezone,

@@ -95,3 +106,3 @@ linkAttachment: {

retweetComment,
retweetCommentLinks: parseTwitterLinks(retweetComment),
retweetCommentLinks: canHaveLinks ? links : [],
retweetProfile: getRetweetProfileInfo(post),

@@ -98,0 +109,0 @@ sent: post.status === 'sent',

@@ -7,3 +7,4 @@ module.exports = profile => ({

handle: profile.service_username,
notifications: profile.counts.pending,
pendingCount: profile.counts.pending,
sentCount: profile.counts.sent,
timezone: profile.timezone,

@@ -10,0 +11,0 @@ schedules: profile.schedules,

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