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

codelabs-react

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codelabs-react - npm Package Compare versions

Comparing version 1.7.1 to 1.7.2

3

babel.config.json
{
"presets": ["@babel/react", "@babel/preset-env"]
"presets": ["@babel/react", "@babel/preset-env"],
"plugins": ["@babel/plugin-proposal-optional-chaining"]
}

@@ -51,2 +51,4 @@ "use strict";

content: paragraph.elements.map(function (element) {
var _element$textRun;
// TODO(): add image support

@@ -63,3 +65,3 @@ if (element.inlineObjectElement) {

return _objectSpread(_objectSpread(_objectSpread({
content: element.textRun.content
content: element === null || element === void 0 ? void 0 : (_element$textRun = element.textRun) === null || _element$textRun === void 0 ? void 0 : _element$textRun.content
}, getElementProperties(element)), getBold(element)), getItalic(element));

@@ -141,6 +143,10 @@ })

try {
if (textRun.textStyle && textRun.textStyle.foregroundColor && textRun.textStyle.link) {
var _textRun$textStyle, _textRun$textStyle2;
if (textRun !== null && textRun !== void 0 && (_textRun$textStyle = textRun.textStyle) !== null && _textRun$textStyle !== void 0 && _textRun$textStyle.foregroundColor && textRun !== null && textRun !== void 0 && (_textRun$textStyle2 = textRun.textStyle) !== null && _textRun$textStyle2 !== void 0 && _textRun$textStyle2.link) {
var _textRun$textStyle3, _textRun$textStyle3$l;
return {
type: "link",
href: textRun.textStyle.link.url
href: textRun === null || textRun === void 0 ? void 0 : (_textRun$textStyle3 = textRun.textStyle) === null || _textRun$textStyle3 === void 0 ? void 0 : (_textRun$textStyle3$l = _textRun$textStyle3.link) === null || _textRun$textStyle3$l === void 0 ? void 0 : _textRun$textStyle3$l.url
};

@@ -155,6 +161,10 @@ }

try {
if (textRun.textStyle && textRun.textStyle.backgroundColor && textRun.textStyle.link) {
var _textRun$textStyle4, _textRun$textStyle5;
if (textRun !== null && textRun !== void 0 && (_textRun$textStyle4 = textRun.textStyle) !== null && _textRun$textStyle4 !== void 0 && _textRun$textStyle4.backgroundColor && textRun !== null && textRun !== void 0 && (_textRun$textStyle5 = textRun.textStyle) !== null && _textRun$textStyle5 !== void 0 && _textRun$textStyle5.link) {
var _textRun$textStyle6, _textRun$textStyle6$l;
return {
type: "button-link",
href: textRun.textStyle.link.url
href: textRun === null || textRun === void 0 ? void 0 : (_textRun$textStyle6 = textRun.textStyle) === null || _textRun$textStyle6 === void 0 ? void 0 : (_textRun$textStyle6$l = _textRun$textStyle6.link) === null || _textRun$textStyle6$l === void 0 ? void 0 : _textRun$textStyle6$l.url
};

@@ -168,11 +178,11 @@ }

function getCommandLineSnippet(textRun) {
try {
if (textRun.textStyle.weightedFontFamily.fontFamily === "Consolas") {
return {
type: "command-line-snippet"
};
}
} catch (e) {
return undefined;
var _textRun$textStyle7, _textRun$textStyle7$w;
if ((textRun === null || textRun === void 0 ? void 0 : (_textRun$textStyle7 = textRun.textStyle) === null || _textRun$textStyle7 === void 0 ? void 0 : (_textRun$textStyle7$w = _textRun$textStyle7.weightedFontFamily) === null || _textRun$textStyle7$w === void 0 ? void 0 : _textRun$textStyle7$w.fontFamily) === "Consolas") {
return {
type: "command-line-snippet"
};
}
return undefined;
}

@@ -238,3 +248,5 @@

return content.filter(function (node) {
return node.paragraph && node.paragraph.paragraphStyle.namedStyleType === type;
var _node$paragraph, _node$paragraph$parag;
return node.paragraph && (node === null || node === void 0 ? void 0 : (_node$paragraph = node.paragraph) === null || _node$paragraph === void 0 ? void 0 : (_node$paragraph$parag = _node$paragraph.paragraphStyle) === null || _node$paragraph$parag === void 0 ? void 0 : _node$paragraph$parag.namedStyleType) === type;
});

@@ -244,27 +256,21 @@ }

function getBold(element) {
try {
return {
bold: !!element.textRun.textStyle.bold
};
} catch (ex) {
return false;
}
var _element$textRun2, _element$textRun2$tex;
return {
bold: !!(element !== null && element !== void 0 && (_element$textRun2 = element.textRun) !== null && _element$textRun2 !== void 0 && (_element$textRun2$tex = _element$textRun2.textStyle) !== null && _element$textRun2$tex !== void 0 && _element$textRun2$tex.bold)
};
}
function getItalic(element) {
try {
return {
italic: !!element.textRun.textStyle.italic
};
} catch (ex) {
return false;
}
var _element$textRun3, _element$textRun3$tex;
return {
italic: !!(element !== null && element !== void 0 && (_element$textRun3 = element.textRun) !== null && _element$textRun3 !== void 0 && (_element$textRun3$tex = _element$textRun3.textStyle) !== null && _element$textRun3$tex !== void 0 && _element$textRun3$tex.italic)
};
}
function getParagraphText(node) {
try {
return node.paragraph.elements[0].textRun.content;
} catch (ex) {
return "";
}
var _node$paragraph2, _node$paragraph2$elem, _node$paragraph2$elem2;
return node === null || node === void 0 ? void 0 : (_node$paragraph2 = node.paragraph) === null || _node$paragraph2 === void 0 ? void 0 : (_node$paragraph2$elem = _node$paragraph2.elements[0]) === null || _node$paragraph2$elem === void 0 ? void 0 : (_node$paragraph2$elem2 = _node$paragraph2$elem.textRun) === null || _node$paragraph2$elem2 === void 0 ? void 0 : _node$paragraph2$elem2.content;
}

@@ -271,0 +277,0 @@

{
"name": "codelabs-react",
"version": "1.7.1",
"version": "1.7.2",
"description": "",

@@ -21,2 +21,3 @@ "main": "dist/index.js",

"@babel/core": "^7.12.10",
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
"@babel/preset-env": "^7.12.11",

@@ -23,0 +24,0 @@ "@babel/preset-react": "^7.12.10",

@@ -44,3 +44,3 @@ const infoColor = { red: 0.8509804, green: 0.91764706, blue: 0.827451 };

return {
content: element.textRun.content,
content: element?.textRun?.content,
...getElementProperties(element),

@@ -160,10 +160,6 @@ ...getBold(element),

try {
if (
textRun.textStyle &&
textRun.textStyle.foregroundColor &&
textRun.textStyle.link
) {
if (textRun?.textStyle?.foregroundColor && textRun?.textStyle?.link) {
return {
type: "link",
href: textRun.textStyle.link.url,
href: textRun?.textStyle?.link?.url,
};

@@ -178,10 +174,6 @@ }

try {
if (
textRun.textStyle &&
textRun.textStyle.backgroundColor &&
textRun.textStyle.link
) {
if (textRun?.textStyle?.backgroundColor && textRun?.textStyle?.link) {
return {
type: "button-link",
href: textRun.textStyle.link.url,
href: textRun?.textStyle?.link?.url,
};

@@ -195,11 +187,8 @@ }

function getCommandLineSnippet(textRun) {
try {
if (textRun.textStyle.weightedFontFamily.fontFamily === "Consolas") {
return {
type: "command-line-snippet",
};
}
} catch (e) {
return undefined;
if (textRun?.textStyle?.weightedFontFamily?.fontFamily === "Consolas") {
return {
type: "command-line-snippet",
};
}
return undefined;
}

@@ -259,3 +248,3 @@

(node) =>
node.paragraph && node.paragraph.paragraphStyle.namedStyleType === type
node.paragraph && node?.paragraph?.paragraphStyle?.namedStyleType === type
);

@@ -265,27 +254,15 @@ }

function getBold(element) {
try {
return {
bold: !!element.textRun.textStyle.bold,
};
} catch (ex) {
return false;
}
return {
bold: !!element?.textRun?.textStyle?.bold,
};
}
function getItalic(element) {
try {
return {
italic: !!element.textRun.textStyle.italic,
};
} catch (ex) {
return false;
}
return {
italic: !!element?.textRun?.textStyle?.italic,
};
}
function getParagraphText(node) {
try {
return node.paragraph.elements[0].textRun.content;
} catch (ex) {
return "";
}
return node?.paragraph?.elements[0]?.textRun?.content;
}

@@ -292,0 +269,0 @@

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