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.9 to 0.2.0

5

dist/libs/tdk-api.d.ts

@@ -0,4 +1,7 @@

import { IGetWord } from '../types';
export declare class TDKAPI {
constructor();
getWord(word: string): string;
getWord(word: string): Promise<IGetWord>;
isExistWord(word: string): Promise<boolean>;
getProVerbs(value: string): Promise<any>;
}

48

dist/libs/tdk-api.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
const tdk_errors_1 = require("../errors/tdk-errors");
class TDKAPI {
constructor() { }
getWord(word) {
return word;
async getWord(word) {
if (word.trim().length < 1)
throw new tdk_errors_1.InvalidWord();
let response = await axios_1.default.get(`https://sozluk.gov.tr/gts?ara=${encodeURI(word)}`);
if (response.data.error)
throw new tdk_errors_1.ValueNotFound();
let anlamlar = [];
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,
};
}
async isExistWord(word) {
if (word.trim().length < 1)
throw new tdk_errors_1.InvalidWord();
let response = await axios_1.default.get(`https://sozluk.gov.tr/gts?ara=${encodeURI(word)}`);
return response.data.length > 0 ? true : false;
}
async getProVerbs(value) {
if (value.trim().length < 1)
throw new tdk_errors_1.InvalidWord();
let response = await axios_1.default.get(`https://sozluk.gov.tr/atasozu?ara=${encodeURI(value)}`);
if (response.data.error)
throw new tdk_errors_1.ValueNotFound();
let proverbs = [{ soz: '', anlam: '', tur: '' }];
for (const element of response.data) {
proverbs.push({
soz: element.sozum,
tur: element.turu2,
anlam: element.anlami,
});
}
return { proverbs };
}
}
exports.TDKAPI = TDKAPI;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
{
"name": "@technoeren/tdk-api",
"version": "0.1.9",
"version": "0.2.0",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts",

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