@skipper-dev/essentials
Advanced tools
Comparing version 1.0.7 to 1.1.0
50
main.js
@@ -0,23 +1,37 @@ | ||
var axios = require("axios") | ||
module.exports = { | ||
decodeBase64(input) { | ||
if (!input) return Error('You need to specify a base64 string to decode.') | ||
if (typeof (input) != 'string') return Error('You have to provide a input type of string, recieved type ' + typeof (input)) | ||
try { | ||
var decoded = new Buffer(input, 'base64').toString('ascii') | ||
return decoded | ||
} catch (err) { | ||
return Error(err) | ||
} | ||
base64: { | ||
decodeBase64(input) { | ||
if (!input) return Error('You need to specify a base64 string to decode.') | ||
if (typeof (input) != 'string') return Error('You have to provide a input type of string, recieved type ' + typeof (input)) | ||
try { | ||
var decoded = new Buffer(input, 'base64').toString('ascii') | ||
return decoded | ||
} catch (err) { | ||
return Error(err) | ||
} | ||
}, | ||
encodeBase64(input) { | ||
if (!input) return Error('You need to specify a string to encode.') | ||
if (typeof (input) != 'string') return Error('You have to provide a input type of string, recieved type ' + typeof (input)) | ||
try { | ||
var decoded = new Buffer(input).toString('base64') | ||
return decoded | ||
} catch (err) { | ||
return Error(err) | ||
} | ||
} | ||
}, | ||
encodeBase64(input) { | ||
if (!input) return Error('You need to specify a string to encode.') | ||
if (typeof (input) != 'string') return Error('You have to provide a input type of string, recieved type ' + typeof(input)) | ||
try { | ||
var decoded = new Buffer(input).toString('base64') | ||
return decoded | ||
} catch (err) { | ||
return Error(err) | ||
web: { | ||
getRequest(url, headers) { | ||
if (!url) return Error('Need to provide a URL to make a web request to.') | ||
if (!headers) var headers = {} | ||
axios.default({ | ||
method: 'GET', | ||
url: url, | ||
headers: headers | ||
}).then(dat => {return dat}).catch(err => {return Error(err)}) | ||
} | ||
} | ||
} |
{ | ||
"name": "@skipper-dev/essentials", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "A essentials module with every important feature the npm community features and some more. Basicially just a big chunk of utils", | ||
@@ -16,3 +16,6 @@ "main": "main.js", | ||
"author": "Constantin", | ||
"license": "ISC" | ||
"license": "ISC", | ||
"dependencies": { | ||
"axios": "^0.19.2" | ||
} | ||
} |
2161
35
1
+ Addedaxios@^0.19.2
+ Addedaxios@0.19.2(transitive)
+ Addedfollow-redirects@1.5.10(transitive)