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

react-text-to-speech

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-text-to-speech - npm Package Compare versions

Comparing version

to
1.4.0

12

dist/index.js

@@ -17,2 +17,3 @@ import { __spreadValues, __objRest, HiVolumeUp, HiVolumeOff, HiMiniStop } from './chunks/chunk-3KTCESQJ.js';

var specialSymbol = "\xA0";
var sanitizedRegex = new RegExp(` (?:${Object.values(symbolMapping).join("|")})${specialSymbol}`, "g");

@@ -64,2 +65,3 @@ // src/state.ts

}
var calculateOriginalTextLength = (sanitizedText) => sanitizedText.replace(sanitizedRegex, " ").length;
function cancel(stopReason = "manual") {

@@ -210,2 +212,3 @@ var _a;

const key = useMemo(() => NodeToKey(text), [text]);
const stringifiedVoices = useMemo(() => JSON.stringify(voiceURI), [voiceURI]);
const { words, sanitizedText } = useMemo(() => {

@@ -227,2 +230,3 @@ const words2 = NodeToWords(text);

utterance.text = currentText.trimStart();
let processedTextLength = 0;
let offset = currentText.length - utterance.text.length;

@@ -232,6 +236,6 @@ updateProps({ pitch, rate, volume, lang, voiceURI });

if (state.stopReason === "auto" && currentChunk < chunks.length - 1) {
offset += utterance.text.length;
processedTextLength += calculateOriginalTextLength(chunks[currentChunk]);
currentText = chunks[++currentChunk];
utterance.text = currentText.trimStart();
offset += currentText.length - utterance.text.length;
offset = processedTextLength + currentText.length - utterance.text.length;
return speakFromQueue();

@@ -329,3 +333,3 @@ }

const timeout = setTimeout(() => {
updateProps({ pitch, rate, volume });
updateProps({ pitch, rate, volume, lang, voiceURI });
stop({ stopReason: "change" });

@@ -335,3 +339,3 @@ emit(onQueueChange);

return () => clearTimeout(timeout);
}, [pitch, rate, volume]);
}, [pitch, rate, volume, lang, stringifiedVoices]);
return {

@@ -338,0 +342,0 @@ Text,

{
"name": "react-text-to-speech",
"version": "1.3.1",
"version": "1.4.0",
"description": "An easy-to-use React.js component that leverages the Web Speech API to convert text to speech.",

@@ -5,0 +5,0 @@ "license": "MIT",