mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
рефакторинг кода, стал более компактным и быстрым
This commit is contained in:
parent
e21330bee7
commit
8557863193
1 changed files with 12 additions and 10 deletions
|
@ -5,17 +5,19 @@ const axios = require("axios");
|
||||||
const config = yaml.parse(fs.readFileSync("./config.yaml", "utf-8"));
|
const config = yaml.parse(fs.readFileSync("./config.yaml", "utf-8"));
|
||||||
|
|
||||||
async function saveCourse() {
|
async function saveCourse() {
|
||||||
for (let i = 0; i < config['currency'].length; i++) {
|
|
||||||
for (let pair in config['currency'] ) {
|
|
||||||
const res = await axios.get(
|
|
||||||
`https://duckduckgo.com/js/spice/currency/1/${config['currency'][i]}/${config['currency'][pair]}`
|
|
||||||
)
|
|
||||||
console.log(res.data)
|
|
||||||
|
|
||||||
//TODO: добавить сохранение в бд
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
let pairs = [];
|
||||||
|
let currencies = ["USD", "RUB", "UAH", "JDF"]
|
||||||
|
config['currency'].forEach(
|
||||||
|
(value) => config['currency'].forEach(async (pair) => {
|
||||||
|
if(value !== pair) {
|
||||||
|
const res = await axios.get(
|
||||||
|
`https://duckduckgo.com/js/spice/currency/1/${value}/${pair}`
|
||||||
|
)
|
||||||
|
console.log(res.data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue