@cfvdb/core
Advanced tools
Comparing version 0.0.1 to 0.0.2
const axios = require('axios'); | ||
const {sanitizeCardNumber} = require('./utils'); | ||
const netlifyFunctionUrl = 'https://laughing-murdock-41e120.netlify.app/.netlify/functions/server/'; | ||
/** | ||
@@ -13,3 +11,3 @@ * Fetches the data of card. | ||
if (!options.url) { | ||
options.url = '/dump/'; | ||
throw new Error('Url of API is not provided.'); | ||
} | ||
@@ -20,3 +18,3 @@ | ||
method: 'get', | ||
url: netlifyFunctionUrl + 'card/' + sanitizeCardNumber(cardNumber) | ||
url: options.url + 'card/' + sanitizeCardNumber(cardNumber) | ||
}); | ||
@@ -26,3 +24,3 @@ | ||
} catch (e) { | ||
console.log(cardNumber + ' not found'); | ||
console.error(cardNumber + ' not found'); | ||
return {}; | ||
@@ -34,3 +32,3 @@ } | ||
if (!options.url) { | ||
options.url = '/dump/'; | ||
throw new Error('Url of API is not provided.'); | ||
} | ||
@@ -41,3 +39,3 @@ | ||
method: 'get', | ||
url: netlifyFunctionUrl + 'cards/?numbers=' + JSON.stringify(cardNumbers) | ||
url: options.url + 'cards/?numbers=' + JSON.stringify(cardNumbers) | ||
}); | ||
@@ -47,3 +45,3 @@ | ||
} catch (e) { | ||
console.log('Card numbers not found'); | ||
console.error('Card numbers not found'); | ||
return []; | ||
@@ -50,0 +48,0 @@ } |
@@ -10,3 +10,3 @@ const axios = require('axios'); | ||
if (!options.url) { | ||
options.url = 'https://laughing-murdock-41e120.netlify.app/.netlify/functions/server'; | ||
throw new Error('Url of API is not provided.'); | ||
} | ||
@@ -13,0 +13,0 @@ |
const PREAMBLE = '****** Cardfight Vanguard Deck List ******'; | ||
const POSTAMBLE = '****** Deck List Generated by ... ******'; | ||
const POSTAMBLE = '****** Deck List Generated by CFVDB ******'; | ||
@@ -5,0 +5,0 @@ class DeckListGenerator { |
{ | ||
"name": "@cfvdb/core", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Core functions for CFVDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6296
202