diff --git a/src/handleOptions.js b/src/handleOptions.js index 0f405af..9068ef0 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -1,5 +1,5 @@ import * as core from '@actions/core'; -import stringToJson from '@cycjimmy/awesome-js-funcs/typeConversion/stringToJson.js'; +import stringToJson from './stringToJson.js'; import inputs from './inputs.json' with { type: 'json' };; /** diff --git a/src/stringToJson.js b/src/stringToJson.js new file mode 100644 index 0000000..bf36359 --- /dev/null +++ b/src/stringToJson.js @@ -0,0 +1,11 @@ +// stringToJson.js +const strToJsonFunc = (str) => (new Function(`return ${str}`))(); +const strToJson = (str) => { + try { + return strToJsonFunc(str); + } catch (e) { + return str; + } +}; + +export default (str) => strToJson(strToJson(str)); \ No newline at end of file