Comparing version 1.0.6 to 1.0.7
58
app.js
@@ -23,5 +23,24 @@ const request = require('node-superfetch'); | ||
if(!yazi) throw new TypeError('Lütfen bir yazı gir. Örneğin; nabun la gevşek (nAbUN lA gEVşEk)') | ||
if(yazi.includes(Number)) throw new TypeError('Kekoca yazıyoruz. Bu yüzden bir sayı olmamalı. Lütfen sayı olmadan bir yazı gir.') | ||
try { | ||
const { body } = await request.get("https://croxy-api.glitch.me/kekoca?key=e0b42f93-dd1b-4f00-948e-2d9340fcf223&yaz="+yazi); | ||
return body.kekoca | ||
const str = yazi | ||
var CASES = [ | ||
String.prototype.toUpperCase, | ||
String.prototype.toLowerCase | ||
]; | ||
var l = str.length; | ||
var buff = ''; | ||
var f; | ||
var i; | ||
var j; | ||
for (i = 0; i < l; i++) { | ||
// Randomly choose one between toUpperCase and toLowerCase. | ||
j = Number(Math.random() <= 0.5); | ||
f = CASES[j]; | ||
buff += f.call(str[i]) | ||
} | ||
return buff | ||
} catch (err) { | ||
@@ -53,4 +72,6 @@ throw new TypeError(err); | ||
try { | ||
const { body } = await request.get("https://croxy-api.glitch.me/sifreolustur?key=e0b42f93-dd1b-4f00-948e-2d9340fcf223&uzunluk="+sayi); | ||
return body.şifre | ||
var pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | ||
var pwdLen = sayi; | ||
var şifre = Array(pwdLen).fill(pwdChars).map(function(x) { return x[Math.floor(Math.random() * x.length)] }).join(''); | ||
return şifre | ||
} catch (err) { | ||
@@ -84,19 +105,18 @@ throw new TypeError(err); | ||
}, | ||
tarih: async function(tarih, sayi) { | ||
tarih: async function(tarih, format) { | ||
if(!tarih) throw new TypeError('Lütfen bir tarih girin. Örneğin; 81204827 ya da January 1, 2019') | ||
const moment = require("moment") | ||
moment.locale("tr") | ||
moment(tarih).day(String); | ||
try { | ||
if(!isNaN(tarih)) { | ||
var tarih = `${moment(tarih).format('DD MMM YYYY ddd')} ${moment(tarih).format('HH:mm:ss')}` | ||
} else { | ||
var tarih = `${moment(tarih).format('DD MMM YYYY ddd')} ${moment(tarih).format('HH:mm:ss')}` | ||
} | ||
if(tarih === 'Invalid date Invalid date') throw new TypeError(`Lütfen geçerli bir tarih girin.`); | ||
return tarih | ||
} catch (err) { | ||
throw new TypeError(`Lütfen geçerli bir tarih girin.`); | ||
} | ||
var x = new Date(tarih) | ||
const tarih = new Date(Date.UTC(x.getFullYear(), x.getMonth(), x.getDate(), x.getHours(), x.getMinutes(), x.getSeconds())) | ||
var aylar = ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"]; | ||
var günler = ["Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"]; | ||
const saat = `${tarih.getHours() < 10 ? "0" + tarih.getHours() : tarih.getHours()}:${tarih.getMinutes() < 10 ? "0" + tarih.getMinutes() : tarih.getMinutes()}:${tarih.getSeconds() < 10 ? "0" + tarih.getSeconds() : tarih.getSeconds()}` | ||
var z = `${tarih.getDate() < 10 ? "0" + tarih.getDate() : tarih.getDate()} ${aylar[tarih.getMonth()]} ${tarih.getFullYear()} ${gunler[tarih.getDay()]} ${saat}` | ||
if(z.includes(NaN || undefined)) throw new TypeError(`Lütfen geçerli bir tarih girin.`); | ||
if(format) { | ||
const y = format.replace("S", tarih.getHours() < 10 ? "0" + tarih.getHours() : tarih.getHours()).replace("D", tarih.getMinutes() < 10 ? "0" + tarih.getMinutes() : tarih.getMinutes()).replace("s", tarih.getSeconds() < 10 ? "0" + tarih.getSeconds() : tarih.getSeconds()).replace("G", tarih.getDate() < 10 ? "0" + tarih.getDate() : tarih.getDate()).replace("A", aylar[tarih.getMonth()]).replace("Y", tarih.getFullYear()).replace("g", gunler[tarih.getDay()]) | ||
return y | ||
} else { | ||
return z | ||
} | ||
} | ||
}; |
{ | ||
"name": "croxy-api", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Gelişmiş bir Türkçe modül. Döviz, çeviri, tarih, para birimine çevirme, dizi arama, şarkı sözü arama vb.", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
@@ -6,2 +6,3 @@ # CroxyApi - Gelişmiş Bir Türkçe Modül! | ||
#Yenilikler | ||
* Tarihe format ayarlama eklendi. | ||
* Ufak iyileştirmeler yapıldı. | ||
@@ -64,7 +65,9 @@ | ||
const tarih = new Date() | ||
//Eğer formatsız yapmak isterseniz: | ||
croxy.tarih(tarih) | ||
//Formatlı yapmak isterseniz: | ||
croxy.tarih(tarih, 'G A Y S:D:s') //"Gün Ay Yıl Saat:Dakika:Saniye" şeklinde verecektir. İstediğiniz gibi düzenleyebilirsiniz. | ||
``` | ||
* Eklenecekler | ||
> Tarih formatını ayarlayabilme, film arama sistemi | ||
> Film arama sistemi |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8468
115
72