-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8757f7
commit 333efee
Showing
8 changed files
with
518 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
package.json | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type {import("prettier").Config} */ | ||
const config = { | ||
trailingComma: "none", | ||
tabWidth: 2, | ||
semi: false, | ||
singleQuote: false, | ||
bracketSpacing: true, | ||
printWidth: 200 | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
const axios = require("axios"); | ||
const axios = require("axios") | ||
|
||
async function neko() { | ||
try { | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/neko"); | ||
return data; | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/neko") | ||
return data | ||
} catch (err) { | ||
console.log(err); | ||
return String(err); | ||
console.log(err) | ||
return String(err) | ||
} | ||
} | ||
|
||
async function waifu() { | ||
try { | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/waifu"); | ||
return data; | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/waifu") | ||
return data | ||
} catch (err) { | ||
console.log(err); | ||
return String(err); | ||
console.log(err) | ||
return String(err) | ||
} | ||
} | ||
|
||
async function shinobu() { | ||
try { | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/shinobu"); | ||
return data; | ||
const { data } = await axios.get("https://api.waifu.pics/sfw/shinobu") | ||
return data | ||
} catch (err) { | ||
console.log(err); | ||
return String(err); | ||
console.log(err) | ||
return String(err) | ||
} | ||
} | ||
|
||
module.exports = { neko, waifu, shinobu }; | ||
module.exports = { neko, waifu, shinobu } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
function isUrl(url) { | ||
return url.match( | ||
new RegExp( | ||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi | ||
) | ||
); | ||
return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi)) | ||
} | ||
|
||
module.exports = { isUrl }; | ||
module.exports = { isUrl } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
var SI_SYMBOL = ["", "K", "M", "G", "T", "P", "E"]; | ||
var SI_SYMBOL = ["", "K", "M", "G", "T", "P", "E"] | ||
|
||
function convertMs(duration) { | ||
seconds = parseInt((duration/1000)%60) | ||
minutes = parseInt((duration/(1000*60))%60) | ||
hours = parseInt((duration/(1000*60*60))%24); | ||
hours = (hours < 10) ? "0" + hours : hours; | ||
minutes = (minutes < 10) ? "0" + minutes : minutes; | ||
seconds = (seconds < 10) ? "0" + seconds : seconds; | ||
seconds = parseInt((duration / 1000) % 60) | ||
minutes = parseInt((duration / (1000 * 60)) % 60) | ||
hours = parseInt((duration / (1000 * 60 * 60)) % 24) | ||
hours = hours < 10 ? "0" + hours : hours | ||
minutes = minutes < 10 ? "0" + minutes : minutes | ||
seconds = seconds < 10 ? "0" + seconds : seconds | ||
return hours + ":" + minutes + ":" + seconds | ||
} | ||
|
||
function convertSec(sec) { | ||
var hours = Math.floor(sec / 3600); | ||
hours >= 1 ? (sec = sec - hours * 3600) : (hours = "00"); | ||
var min = Math.floor(sec / 60); | ||
min >= 1 ? (sec = sec - min * 60) : (min = "00"); | ||
sec < 1 ? (sec = "00") : void 0; | ||
min.toString().length == 1 ? (min = "0" + min) : void 0; | ||
sec.toString().length == 1 ? (sec = "0" + sec) : void 0; | ||
return hours + ":" + min + ":" + sec; | ||
var hours = Math.floor(sec / 3600) | ||
hours >= 1 ? (sec = sec - hours * 3600) : (hours = "00") | ||
var min = Math.floor(sec / 60) | ||
min >= 1 ? (sec = sec - min * 60) : (min = "00") | ||
sec < 1 ? (sec = "00") : void 0 | ||
min.toString().length == 1 ? (min = "0" + min) : void 0 | ||
sec.toString().length == 1 ? (sec = "0" + sec) : void 0 | ||
return hours + ":" + min + ":" + sec | ||
} | ||
|
||
function convertNum(number) { | ||
// what tier? (determines SI symbol) | ||
var tier = (Math.log10(Math.abs(number)) / 3) | 0; | ||
var tier = (Math.log10(Math.abs(number)) / 3) | 0 | ||
// if zero, we don't need a suffix | ||
if (tier == 0) return number; | ||
if (tier == 0) return number | ||
// get suffix and determine scale | ||
var suffix = SI_SYMBOL[tier]; | ||
var scale = Math.pow(10, tier * 3); | ||
var suffix = SI_SYMBOL[tier] | ||
var scale = Math.pow(10, tier * 3) | ||
// scale the number | ||
var scaled = number / scale; | ||
var scaled = number / scale | ||
// format number and add suffix | ||
return scaled.toFixed(1) + suffix; | ||
return scaled.toFixed(1) + suffix | ||
} | ||
|
||
module.exports = { convertNum, convertSec, convertMs }; | ||
module.exports = { convertNum, convertSec, convertMs } |
Oops, something went wrong.