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

ssml-split

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssml-split - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

11

CHANGELOG.md

@@ -7,6 +7,15 @@ ### Changelog

#### [v0.3.2](https://github.com/jvandenaardweg/ssml-split/compare/0.3.1...v0.3.2)
#### [v0.3.3](https://github.com/jvandenaardweg/ssml-split/compare/0.3.2...v0.3.3)
> 6 January 2020
- Build result [`eda2a5b`](https://github.com/jvandenaardweg/ssml-split/commit/eda2a5b2da1d6c68d6af2b420bc383dd54b2777e)
- Use characterCounter getter [`6cbe48d`](https://github.com/jvandenaardweg/ssml-split/commit/6cbe48da35f19847d1a6b03d564450a28edfe858)
- Correctly strip SSML tags to count like AWS counts [`245eaf0`](https://github.com/jvandenaardweg/ssml-split/commit/245eaf0103ba61b385a90d0ac1ec11d76a12569d)
#### [0.3.2](https://github.com/jvandenaardweg/ssml-split/compare/0.3.1...0.3.2)
> 4 January 2020
- Release 0.3.2 [`ee27ab7`](https://github.com/jvandenaardweg/ssml-split/commit/ee27ab714cc55be9a399e70d88e888543f646a59)
- Update dist build docs [`99f4f96`](https://github.com/jvandenaardweg/ssml-split/commit/99f4f969c97b5e1d3683039e689e6983194ed832)

@@ -13,0 +22,0 @@ - Set correct default softLimit in docs [`da7c2e8`](https://github.com/jvandenaardweg/ssml-split/commit/da7c2e803b4cf3f9aaac98668c917c936f7d9cbd)

6

dist/index.d.ts

@@ -1,2 +0,2 @@

interface OptionsInput {
export interface OptionsInput {
/**

@@ -48,3 +48,3 @@ * Default: `1500`

}
interface Options {
export interface Options {
hardLimit: number;

@@ -66,3 +66,2 @@ softLimit: number;

private textLength;
private characterCounter;
constructor(options?: OptionsInput);

@@ -76,2 +75,3 @@ /**

split(ssmlInput: string): string[];
private get characterCounter();
private setDefaults;

@@ -78,0 +78,0 @@ private sanitize;

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

split(ssmlInput) {
// Set the defaults everytime we invoke split
// So you can use the split method multiple times using the same class instance
this.setDefaults();

@@ -48,5 +50,5 @@ // Create a copy so ssmlInput stays intact when we replace paragraphs with breaks

this.buildTree(this.sanitize(ssmlToWorkWith));
// check if SSML is wrapped with <speak> tag
// Check if SSML is wrapped with <speak> tag
if (this.root.children.length === 1 && this.root.children[0].type === 'speak') {
// remove global <speak> tag node
// Remove global <speak> tag node
// since the text will be split, new <speak> tags will wrap batches

@@ -58,5 +60,4 @@ this.root.children = this.root.children[0].children;

}
// start traversing root children
// Start traversing root children
this.root.children.forEach((node) => {
this.characterCounter = this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
// root level - can make splits here

@@ -92,4 +93,2 @@ if (this.characterCounter < this.options.softLimit) {

});
// Process the last part
this.characterCounter = this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
if (this.characterCounter !== 0) {

@@ -105,2 +104,5 @@ if (this.characterCounter < this.options.hardLimit) {

}
get characterCounter() {
return this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
}
setDefaults() {

@@ -116,3 +118,2 @@ this.root = {

this.textLength = 0;
this.characterCounter = 0;
}

@@ -119,0 +120,0 @@ sanitize(ssml) {

{
"name": "ssml-split",
"version": "0.3.2",
"version": "0.3.3",
"description": "Splits long texts with SSML tags by batches suitable for working with AWS Polly TTS and Google Cloud Text to Speech.",

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

@@ -5,3 +5,3 @@ import pollyTextSplit from 'polly-text-split';

interface OptionsInput {
export interface OptionsInput {
/**

@@ -54,3 +54,3 @@ * Default: `1500`

interface Options {
export interface Options {
hardLimit: number;

@@ -86,3 +86,2 @@ softLimit: number;

private textLength: number;
private characterCounter: number;

@@ -112,2 +111,4 @@ constructor(options?: OptionsInput) {

public split(ssmlInput: string): string[] {
// Set the defaults everytime we invoke split
// So you can use the split method multiple times using the same class instance
this.setDefaults();

@@ -130,5 +131,5 @@

// check if SSML is wrapped with <speak> tag
// Check if SSML is wrapped with <speak> tag
if (this.root.children.length === 1 && this.root.children[0].type === 'speak') {
// remove global <speak> tag node
// Remove global <speak> tag node
// since the text will be split, new <speak> tags will wrap batches

@@ -142,6 +143,4 @@ this.root.children = this.root.children[0].children!;

// start traversing root children
// Start traversing root children
this.root.children.forEach((node) => {
this.characterCounter = this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
// root level - can make splits here

@@ -177,5 +176,2 @@ if (this.characterCounter < this.options.softLimit) {

// Process the last part
this.characterCounter = this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
if (this.characterCounter !== 0) {

@@ -192,2 +188,6 @@ if (this.characterCounter < this.options.hardLimit) {

private get characterCounter() {
return this.options.includeSSMLTagsInCounter ? this.accumulatedSSML.length : this.textLength;
}
private setDefaults() {

@@ -204,3 +204,2 @@ this.root = {

this.textLength = 0;
this.characterCounter = 0;
}

@@ -207,0 +206,0 @@

Sorry, the diff of this file is too big to display

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