refactor: Create net-request-promise helper for runtimesettin

This commit is contained in:
Susmitha Girumala committed 2021-05-13 12:50:01 -04:00
1 parent 9f32b8cdc3
commit cc01bddea3
5 files changed
+18 -9

No files matched your search

@@ -1,9 +1,11 @@
const { quote } = require('shell-quote');
module.exports = {
/**
* Super paranoid shell quote/escape and validation. Input must be base62.
* @param {string} str
*/
escapeAndValidate: (str) => {
base62EscapeAndValidate: (str) => {
const candidate = str.toString();
if (candidate.match(/^[A-Za-z0-9_]*$/)) return candidate;
throw new Error(`
@@ -11,4 +13,10 @@ module.exports = {
input contained unsafe characters.
`);
},
/**
* Return a quoted string suitable for using in shell commands.
* @param {string} str
* @returns {string}
*/
shellEscape: (str) => quote([str]),
};