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

@acrossthecloud/speakhtml

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acrossthecloud/speakhtml - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

17

dist/index.js

@@ -14,3 +14,3 @@ "use strict";

const fs = require("fs");
const handleElem = (s) => {
const handleElem = (s, filter) => {
if (!s.tagName) {

@@ -24,2 +24,5 @@ if (s.nodeType !== s.COMMENT_NODE) {

}
if (filter && filter(s)) {
return '';
}
if (['video', 'audio', 'iframe'].includes(s.tagName.toLowerCase())) {

@@ -53,3 +56,3 @@ return '';

return headerTags[s.tagName.toLowerCase()] + (s.hasChildNodes ? Array.from(s.childNodes).reduce((acc, node) => {
return acc + handleElem(node);
return acc + handleElem(node, filter);
}, '') : '') + '</emphasis>';

@@ -71,3 +74,3 @@ }

return ssmlTagName + (s.hasChildNodes ? Array.from(s.childNodes).reduce((acc, node) => {
return acc + handleElem(node);
return acc + handleElem(node, filter);
}, '') : '') + (ssmlTagName ? ssmlTagName.replace('<', '</') : '');

@@ -88,8 +91,8 @@ };

}
const fromHTML = (s, enclosed = true) => {
return (enclosed ? '<speak>' : '') + handleElem((new jsdom_1.JSDOM(s)).window.document.body).replace(/\s\s+/g, ' ') + (enclosed ? '</speak>' : '');
const fromHTML = (s, enclosed = true, filter) => {
return (enclosed ? '<speak>' : '') + handleElem((new jsdom_1.JSDOM(s)).window.document.body, filter).replace(/\s\s+/g, ' ') + (enclosed ? '</speak>' : '');
};
const fromURL = (u, enclosed = true) => __awaiter(void 0, void 0, void 0, function* () {
const fromURL = (u, enclosed = true, filter) => __awaiter(void 0, void 0, void 0, function* () {
let dom = yield jsdom_1.JSDOM.fromURL(u.toString());
return (enclosed ? '<speak>' : '') + handleElem(dom.window.document.body).replace(/\s\s+/g, ' ') + (enclosed ? '</speak>' : '');
return (enclosed ? '<speak>' : '') + handleElem(dom.window.document.body, filter).replace(/\s\s+/g, ' ') + (enclosed ? '</speak>' : '');
});

@@ -96,0 +99,0 @@ module.exports = {

{
"name": "@acrossthecloud/speakhtml",
"version": "0.7.0",
"version": "0.8.0",
"description": "for converting html to ssml",

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

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