Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@technoeren/tdk-api

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

@technoeren/tdk-api - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

6

package.json
{
"name": "@technoeren/tdk-api",
"version": "0.1.6",
"version": "0.1.7",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"types": "dist/index.d.ts",
"types": "index.js",
"files": [

@@ -26,2 +25,3 @@ "dist",

},
"repository": {

@@ -28,0 +28,0 @@ "type": "git",

@@ -1,69 +0,7 @@

import axios from "axios";
import { InvalidWord, ValueNotFound } from "../errors/tdk-errors";
import { IGetWord } from '../typings';
export class TDKAPI {
constructor() {}
public async getWord(word: string): Promise<IGetWord> {
if (word.trim().length < 1) throw new InvalidWord();
let response = await axios.get(
`https://sozluk.gov.tr/gts?ara=${encodeURI(word)}`
);
if (response.data.error) throw new ValueNotFound();
let anlamlar: any = [];
for (const element of response.data[0].anlamlarListe) {
anlamlar.push({
anlam: element.anlam,
ornek: element.orneklerListe ? element.orneklerListe[0].ornek : null,
});
}
return {
anlamlar,
atasozu_deyim: response.data[0].atasozu
? response.data[0].atasozu[0].madde
: null,
};
getWord(word: string): string {
return word;
}
public async isExistWord(word: string): Promise<boolean> {
if (word.trim().length < 1) throw new InvalidWord();
let response = await axios.get(
`https://sozluk.gov.tr/gts?ara=${encodeURI(word)}`
);
return response.data.length > 0 ? true : false;
}
public async getProVerbs(value: string): Promise<any> {
if (value.trim().length < 1) throw new InvalidWord();
let response = await axios.get(
`https://sozluk.gov.tr/atasozu?ara=${encodeURI(value)}`
);
if (response.data.error) throw new ValueNotFound();
let proverbs: any = [{ soz: '', anlam: '', tur: ''}];
for (const element of response.data) {
proverbs.push({
soz: element.sozum,
tur: element.turu2,
anlam: element.anlami,
});
}
return { proverbs };
}
}
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