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

speech-code

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speech-code - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

16

index.d.ts

@@ -1,5 +0,5 @@

// Type definitions for speech-code 1.0
// Project: https://github.com/mamoru-kun/speech-code
// Definitions by: Alexander B. <https://github.com/mamoru-kun>
// Definitions: https://github.com/mamoru-kun/speech-code
// Type definitions for speech-code 1.2.0
// Project: https://github.com/mamoruuu/speech-code
// Definitions by: Alexander B. <https://github.com/mamoruuu>
// Definitions: https://github.com/mamoruuu/speech-code

@@ -12,3 +12,3 @@ export namespace SpeechCode {

*/
export function getText(paragraphs?: Number = 3): string;
export function getText(paragraphs?: number = 3): string;
/**

@@ -18,3 +18,7 @@ * Returns a paragraph consisting of given number of sentences

*/
export function getParagraph(sentences: Number): string;
export function getParagraph(sentences?: number = 3): string;
/**
* Returns a single generated sentence
*/
export function getSentence(): string;
}

@@ -5,6 +5,7 @@ "use strict";

const randomValueFrom = array => {
let index = ~~(array.length * Math.random());
return array[index];
};
/**
* Отдаёт случайный элемент массива
* @param {array} array Массив с элементами
*/
const randomValueFrom = array => array[~~(array.length * Math.random())];

@@ -14,8 +15,9 @@ /**

*/
const buildSentence = () => {
let result = [];
result.push(randomValueFrom(sentenceParts.first));
result.push(randomValueFrom(sentenceParts.second));
result.push(randomValueFrom(sentenceParts.third));
result.push(randomValueFrom(sentenceParts.fourth));
const getSentence = () => {
const result = [
randomValueFrom(sentenceParts.first),
randomValueFrom(sentenceParts.second),
randomValueFrom(sentenceParts.third),
randomValueFrom(sentenceParts.fourth),
];
if (result[0].endsWith("!") || result[0].endsWith(".")) {

@@ -31,7 +33,7 @@ result[1] = result[1].replace(/^./, result[1].slice(0, 1).toUpperCase());

*/
const getParagraph = sentences => {
const getParagraph = (sentences = 3) => {
let result = "";
for (let i = 0; i < sentences; i++) {
if (i > 0) result += " ";
result += buildSentence();
result += getSentence();
}

@@ -57,3 +59,4 @@ return result;

getParagraph,
getText
getText,
getSentence,
};

@@ -0,0 +0,0 @@ MIT License

@@ -19,3 +19,3 @@ {

},
"version": "1.1.0",
"version": "1.2.0",
"main": "index.js",

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

@@ -10,3 +10,3 @@ # Russian Speech Code

```
npm install --save speech-code
npm install speech-code
```

@@ -17,9 +17,24 @@

```js
import { getText, getParagraph } from 'speech-code'
import { getText, getParagraph, getSentence } from 'speech-code'
const sentence = getSentence()
const text = getText()
const paragraph = getParagraph(5)
console.log(`Sentence: ${sentence}`)
console.log(`Text: ${text}`)
console.log(`Paragraph: ${paragraph}`)
```
### cli
```sh
npx speech-code text 3
npx speech-code paragraph 4
npx speech-code sentence
# You can also use shorter version of types
npx speech-code t 3
npx speech-code p 4
npx speech-code s
```

@@ -0,0 +0,0 @@ {

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