Skip to content

Instantly share code, notes, and snippets.

@Zeko369
Created June 9, 2023 14:59
Show Gist options
  • Save Zeko369/492f58265b1ceeaffff5eb56dc0ec66a to your computer and use it in GitHub Desktop.
Save Zeko369/492f58265b1ceeaffff5eb56dc0ec66a to your computer and use it in GitHub Desktop.
console.log(
JSON.stringify(
Object.fromEntries(
[...document.querySelectorAll(".config-vars tr")]
.map((row) => [
row.querySelector(".config-var-key").value,
row.querySelector(".config-var-value").value,
])
.filter((item) => !!item[0] && !!item[1])
),
null,
2
)
.split("\n")
.slice(1, -1)
.map((row) => row.trim().slice(1).replace('": ', "="))
.map((row) => (row.endsWith(",") ? row.slice(0, -1) : row))
.join("\n")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment