From 9a905dc8430e2a24f187193e341184459122e120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20=C3=98deg=C3=A5rd=20Uhlen?= <126719+leifode@users.noreply.github.com> Date: Tue, 5 May 2026 12:23:04 +0200 Subject: [PATCH] fixing more issues cjs->esm --- src/handleOptions.js | 2 +- src/stringToJson.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/stringToJson.js 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