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

degausser

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

degausser - npm Package Compare versions

Comparing version 2.4.2 to 2.4.3

32

dist/degausser.js

@@ -398,4 +398,6 @@ (function (global, factory) {

var getAltText = function getAltText(node, placeholderCharacter, placeholderLength) {
var altText = node.getAttribute('alt');
var _node$getAttribute;
var altText = (_node$getAttribute = node.getAttribute('alt')) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.trim();
if (!altText) {

@@ -421,3 +423,4 @@ var altTextPlaceholder = placeholderCharacter.repeat(placeholderLength);

var tagNameLowerCase = tagName.toLowerCase();
return tagNameLowerCase === 'img' || tagNameLowerCase === 'image' || tagNameLowerCase === 'area';
var elementsWithAltText = ['area', 'img', 'input', 'canvas'];
return elementsWithAltText.includes(tagNameLowerCase);
};

@@ -564,2 +567,8 @@

if (node.tagName.toLowerCase() === 'svg' && isOpening) {
var _altText = getAltText(node, this.options.placeholderString, this.options.placeholderCopies);
this.text.push(" ".concat(_altText, " "));
}
this.processBlockConstruct(tag, isOpening);

@@ -852,2 +861,11 @@ return false;

if (node.tagName.toLowerCase() === 'svg' && isOpening) {
var _altText = getAltText(node, this.options.placeholderString, this.options.placeholderCopies);
this.text.push({
node: node,
string: " ".concat(_altText, " ")
});
}
this.processBlockConstruct(node, isOpening);

@@ -941,3 +959,11 @@ return false;

} else {
nodeContent = entity.node.textContent.normalize();
nodeContent = '';
if (entity.node.tagName === 'svg') {
var _altText2 = getAltText(entity.node, this.options.placeholderString, this.options.placeholderCopies).normalize();
nodeContent = _altText2;
}
nodeContent += entity.node.textContent.normalize();
}

@@ -944,0 +970,0 @@

2

package.json
{
"name": "degausser",
"version": "2.4.2",
"version": "2.4.3",
"description": "Transforms HTML to plain text by eliminating tags from a document.",

@@ -5,0 +5,0 @@ "author": "FlowPub",

@@ -222,2 +222,11 @@ import {

if (node.tagName.toLowerCase() === 'svg' && isOpening) {
const altText = getAltText(
node,
this.options.placeholderString,
this.options.placeholderCopies
)
this.text.push({ node, string: ` ${altText} ` })
}
this.processBlockConstruct(node, isOpening)

@@ -308,3 +317,12 @@

} else {
nodeContent = entity.node.textContent.normalize()
nodeContent = ''
if (entity.node.tagName === 'svg') {
const altText = getAltText(
entity.node,
this.options.placeholderString,
this.options.placeholderCopies
).normalize()
nodeContent = altText
}
nodeContent += entity.node.textContent.normalize()
}

@@ -311,0 +329,0 @@

@@ -153,2 +153,10 @@ import {

}
if (node.tagName.toLowerCase() === 'svg' && isOpening) {
const altText = getAltText(
node,
this.options.placeholderString,
this.options.placeholderCopies
)
this.text.push(` ${altText} `)
}

@@ -155,0 +163,0 @@ this.processBlockConstruct(tag, isOpening)

@@ -315,3 +315,3 @@ function autoBind() {

const getAltText = (node, placeholderCharacter, placeholderLength) => {
const altText = node.getAttribute('alt')
const altText = node.getAttribute('alt')?.trim()
if (!altText) {

@@ -336,3 +336,4 @@ const altTextPlaceholder = placeholderCharacter.repeat(placeholderLength)

const tagNameLowerCase = tagName.toLowerCase()
return tagNameLowerCase === 'img' || tagNameLowerCase === 'image' || tagNameLowerCase === 'area'
const elementsWithAltText = ['area', 'img', 'input', 'canvas',]
return elementsWithAltText.includes(tagNameLowerCase)
}

@@ -339,0 +340,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