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

polly-ru-ssml

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polly-ru-ssml - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

2

lib/errors.js

@@ -7,3 +7,3 @@ class ValidationError extends Error {

super(message)
this.name = 'Validation Error'
this.name = this.constructor.name
}

@@ -10,0 +10,0 @@ }

@@ -19,2 +19,12 @@ const { ValidationError } = require('./errors')

// Private prop
const _config = Symbol()
// Private methods
const _validateOptions = Symbol()
const _render = Symbol()
const _isLatinChar = Symbol()
const _isWhitespace = Symbol()
/**

@@ -27,3 +37,3 @@ * @class PollyRuSSML

// default configuration
this._config = {
this[_config] = {
country: 'us',

@@ -46,3 +56,3 @@ }

// use local configuration if passed
options = options || this._config
options = options || this[_config]

@@ -55,3 +65,3 @@ // add default country option if not passed

// check if options are valid, otherwise - throw an error
this._validateOptions(options)
this[_validateOptions](options)

@@ -79,3 +89,3 @@ let globalOpenTags = ''

return this._render(text, globalOpenTags, globalCloseTags, openTags, closeTags)
return this[_render](text, globalOpenTags, globalCloseTags, openTags, closeTags)
}

@@ -102,3 +112,3 @@

* @param {ConfigurationOptions} options Object with configuration options.
*
*
* @example

@@ -109,5 +119,5 @@ * const pollyRuSSML = require('polly-ru-ssml')

configure(options) {
if (this._validateOptions(options)) {
if (this[_validateOptions](options)) {
// merge options with global configuration
this._config = Object.assign({}, this._config, options)
this[_config] = Object.assign({}, this[_config], options)
}

@@ -120,3 +130,3 @@ }

*/
_validateOptions(options) {
[_validateOptions](options) {
if (!options) {

@@ -162,3 +172,3 @@ throw new ValidationError('Parameter "options" is missing.')

* Find and wrap latin characters with `<lang/>` tags.
*
*
* @param {string} text

@@ -171,3 +181,3 @@ * @param {string} globalOpenTags

*/
_render(text, globalOpenTags, globalCloseTags, openTags, closeTags) {
[_render](text, globalOpenTags, globalCloseTags, openTags, closeTags) {
const len = text.length

@@ -181,3 +191,3 @@ let started

for (let i = 0; i < len; i++) {
if (this._isLatinChar(text[i])) {
if (this[_isLatinChar](text[i])) {
if (!started) {

@@ -190,3 +200,3 @@ started = true

// if whitespace - continue
if (this._isWhitespace(text[i])) {
if (this[_isWhitespace](text[i])) {
started = false

@@ -212,3 +222,3 @@ ssml += openTags + text.slice(startPos, i) + closeTags + text[i]

* Check if a character is ASCII latin character.
*
*
* @param {string} char

@@ -218,3 +228,3 @@ * @returns {boolean}

*/
_isLatinChar(char) {
[_isLatinChar](char) {
const cp = char.codePointAt(0)

@@ -226,3 +236,3 @@ return (cp > 64 && cp < 91) || (cp > 96 && cp < 123)

* Check if a character is a space character or equivalent.
*
*
* @param {string} char

@@ -232,3 +242,3 @@ * @returns {boolean}

*/
_isWhitespace(char) {
[_isWhitespace](char) {
return ' \t\n\r\v'.indexOf(char) === -1

@@ -235,0 +245,0 @@ }

{
"name": "polly-ru-ssml",
"version": "0.1.4",
"version": "0.1.5",
"description": "Convert russian text, that contains english words into a valid SSML for AWS Polly TTS, thus enhancing synthesized audio pronunciation for english words within the russian language context.",

@@ -21,4 +21,7 @@ "main": "index.js",

"amazon",
"alexa",
"polly",
"ssml"
"ssml",
"tts",
"russian tts"
],

@@ -25,0 +28,0 @@ "engines": {

@@ -5,3 +5,4 @@ # Polly Russian SSML Enhancer

[![Coverage Status](https://coveralls.io/repos/github/oleglegun/polly-ru-ssml/badge.svg?branch=master)](https://coveralls.io/github/oleglegun/polly-ru-ssml?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

@@ -67,3 +68,3 @@ ## Synopsis

// 2. Local configuration only for current usage (overrides global configuration)
// 2. Local configuration only for the current usage (overrides global configuration)
pollyRuSSML.speak('русский english', {

@@ -111,2 +112,8 @@ globalVolume: 'x-loud',

### [0.1.5] - 2018-04-23
- Hide private methods from user API.
### [0.1.4] - 2018-04-03
- Add more tests.
### [0.1.3] - 2018-04-03

@@ -113,0 +120,0 @@ - Add API reference.

@@ -9,3 +9,3 @@ const t = require('tap')

const testData = [
const testData = [
['123', '123'],

@@ -34,7 +34,7 @@ [' eng ', ' <lang xml:lang="en-US">eng </lang>'],

pollyRuSSML.configure()
})
}, ValidationError)
t.throws(function() {
pollyRuSSML.configure("")
})
pollyRuSSML.configure('')
}, ValidationError)

@@ -57,3 +57,3 @@ const validConfigs = [

t.doesNotThrow(function() {
pollyRuSSML.speak("", options)
pollyRuSSML.speak('', options)
})

@@ -77,4 +77,4 @@ })

t.throws(function() {
pollyRuSSML.speak("", options)
pollyRuSSML.speak('', options)
}, ValidationError)
})
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