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

lingva-scraper-update

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lingva-scraper-update - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

dist/audio.d.ts
import { LangCode } from "./utils/language";
/**
* Retrieves an audio buffer of the given text in the given language
* @param lang - The code of the language to be used as the TTS voice
* @param lang - The code of the language to be used as the TTS voice or "auto" for automatic detection
* @param text - The text to be converted into speech

@@ -9,2 +9,2 @@ * @param [isSlow=false] - Whether the audio should be slowed down or not

*/
export declare const getAudio: (lang: LangCode<"target">, text: string, isSlow?: boolean) => Promise<number[] | null>;
export declare const getAudio: (lang: LangCode<"target"> | "auto", text: string, isSlow?: boolean) => Promise<number[] | null>;

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

* Retrieves an audio buffer of the given text in the given language
* @param lang - The code of the language to be used as the TTS voice
* @param lang - The code of the language to be used as the TTS voice or "auto" for automatic detection
* @param text - The text to be converted into speech

@@ -37,3 +37,8 @@ * @param [isSlow=false] - Whether the audio should be slowed down or not

*/
const getAudio = async (lang, text, isSlow = false) => {
const getAudio = async (lang, // Allow "auto" as a language code
text, isSlow = false) => {
// Handle the "auto" case if needed
if (lang === "auto") {
throw new Error("Auto-detection is not supported for audio. Please specify a target language.");
}
const parsedLang = (0, language_1.mapGoogleCode)(lang);

@@ -47,4 +52,4 @@ const lastSpace = text.lastIndexOf(" ", 200);

.with({ lang: parsedLang, text: encodedText, textLength, speed })
.doing(({ data }) => data ? Array.from(new Uint8Array(data)) : undefined);
.doing(({ data }) => (data ? Array.from(new Uint8Array(data)) : undefined));
};
exports.getAudio = getAudio;

@@ -34,7 +34,6 @@ import { LangCode } from "./language";

lang: {
code: LangCode<"target">;
code: LangCode<"target"> | "auto";
};
text: string;
audio?: number[] | null;
}
export {};

@@ -6,3 +6,3 @@ import { languages, exceptions, mappings } from "./languages.json";

};
declare type LangType = typeof LanguageType[keyof typeof LanguageType];
export declare type LangType = typeof LanguageType[keyof typeof LanguageType];
export declare type LangCode<T extends LangType | void = void> = T extends LangType ? Exclude<keyof typeof languages, keyof typeof exceptions[T]> : keyof typeof languages;

@@ -94,8 +94,2 @@ export declare type LangCodeGoogle<T extends LangCode | LangType = LangCode> = T extends LangType ? Exclude<LangCode<T>, keyof typeof mappings["request"]> | keyof typeof mappings["response"] : Exclude<T, keyof typeof mappings["request"]> | keyof typeof mappings["response"];

ja: string;
/**
* Changes invalid languages for a certain language type with the proper replacement
* @param langType - The type of language to check on
* @param langCode - A *Lingva* language code
* @returns A proper *Lingva* code for that language type
*/
jw: string;

@@ -126,2 +120,7 @@ kn: string;

mi: string;
/**
* Maps a *Lingva* language code to a *Google* one
* @param langCode - A *Lingva* language code
* @returns The proper *Google* code for that language
*/
mr: string;

@@ -238,8 +237,2 @@ "mni-Mtei": string;

ja: string;
/**
* Changes invalid languages for a certain language type with the proper replacement
* @param langType - The type of language to check on
* @param langCode - A *Lingva* language code
* @returns A proper *Lingva* code for that language type
*/
jw: string;

@@ -270,2 +263,7 @@ kn: string;

mi: string;
/**
* Maps a *Lingva* language code to a *Google* one
* @param langCode - A *Lingva* language code
* @returns The proper *Google* code for that language
*/
mr: string;

@@ -382,8 +380,2 @@ "mni-Mtei": string;

ja: string;
/**
* Changes invalid languages for a certain language type with the proper replacement
* @param langType - The type of language to check on
* @param langCode - A *Lingva* language code
* @returns A proper *Lingva* code for that language type
*/
jw: string;

@@ -414,2 +406,7 @@ kn: string;

mi: string;
/**
* Maps a *Lingva* language code to a *Google* one
* @param langCode - A *Lingva* language code
* @returns The proper *Google* code for that language
*/
mr: string;

@@ -470,2 +467,1 @@ "mni-Mtei": string;

};
export {};
{
"name": "lingva-scraper-update",
"version": "1.0.3",
"version": "1.0.4",
"description": "Google Translate scraper for Lingva Translate",

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

@@ -1,21 +0,1 @@

<div align="center">
<img src="img/logo.svg" width="128">
<h1>Lingva Scraper</h1>
<div>
<a href="https://travis-ci.com/thedaviddelta/lingva-scraper">
<img src="https://travis-ci.com/thedaviddelta/lingva-scraper.svg?branch=main" alt="Travis Build">
</a>
<a href="https://npmjs.com/package/lingva-scraper">
<img alt="NPM Version" src="https://img.shields.io/npm/v/lingva-scraper">
</a>
<img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/thedaviddelta/lingva-scraper/v1.1.0?color=20B2AA">
<a href="./LICENSE">
<img src="https://img.shields.io/github/license/thedaviddelta/lingva-scraper" alt="License">
</a>
</div>
<br />
Google Translate scraper for <a href="https://github.com/thedaviddelta/lingva-translate" target="_blank">Lingva Translate</a>
<hr />
</div>
## Installation

@@ -26,3 +6,3 @@

```shell
npm i --save lingva-scraper
npm i --save lingva-scraper-update
```

@@ -33,3 +13,3 @@

```shell
yarn add lingva-scraper
yarn add lingva-scraper-update
```

@@ -40,3 +20,3 @@

```javascript
const { getTranslationInfo } = require("lingva-scraper");
const { getTranslationInfo } = require("lingva-scraper-update");
```

@@ -47,3 +27,3 @@

```javascript
import { getTranslationInfo } from "lingva-scraper";
import { getTranslationInfo } from "lingva-scraper-update";
```

@@ -54,3 +34,3 @@

```javascript
import * as LingvaScraper from "lingva-scraper";
import * as LingvaScraper from "lingva-scraper-update";
```

@@ -72,3 +52,3 @@

```typescript
import { getTranslationText } from "lingva-scraper";
import { getTranslationText } from "lingva-scraper-update";

@@ -87,3 +67,3 @@ const translation = await getTranslationText("auto", "es", "win");

```typescript
import { getTranslationInfo } from "lingva-scraper";
import { getTranslationInfo } from "lingva-scraper-update";

@@ -102,3 +82,3 @@ const info = await getTranslationInfo("zh", "en", "早安");

```typescript
import { getAudio } from "lingva-scraper";
import { getAudio } from "lingva-scraper-update";

@@ -117,3 +97,3 @@ const audio = await getAudio("ca", "gerd");

```typescript
import { LanguageType } from "lingva-scraper";
import { LanguageType } from "lingva-scraper-update";

@@ -129,3 +109,3 @@ LanguageType.SOURCE // "source"

```typescript
import { languageList } from "lingva-scraper";
import { languageList } from "lingva-scraper-update";

@@ -142,3 +122,3 @@ languageList.all // whole list

```typescript
import { isValidCode } from "lingva-scraper";
import { isValidCode } from "lingva-scraper-update";

@@ -154,3 +134,3 @@ const isValidLang = isValidCode(str);

```typescript
import { replaceExceptedCode } from "lingva-scraper";
import { replaceExceptedCode } from "lingva-scraper-update";

@@ -165,3 +145,3 @@ const targetLang = replaceExceptedCode(LanguageType.TARGET, lang);

```typescript
import { mapGoogleCode } from "lingva-scraper";
import { mapGoogleCode } from "lingva-scraper-update";

@@ -176,3 +156,3 @@ const googleLang = mapGoogleCode(lang);

```typescript
import { mapLingvaCode } from "lingva-scraper";
import { mapLingvaCode } from "lingva-scraper-update";

@@ -179,0 +159,0 @@ const lang = mapLingvaCode(googleLang);

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