Skip to content

Instantly share code, notes, and snippets.

@JLarky
Created September 6, 2024 18:28
Show Gist options
  • Save JLarky/fa92b6d05cfb662faf9dde57756f205c to your computer and use it in GitHub Desktop.
Save JLarky/fa92b6d05cfb662faf9dde57756f205c to your computer and use it in GitHub Desktop.
How to decode Astro props for <astro-island> element
((raw)=>{let i = { 0: t => m(t), 1: t => a(t), 2: t => new RegExp(t), 3: t => new Date(t), 4: t => new Map(a(t)), 5: t => new Set(a(t)), 6: t => BigInt(t), 7: t => new URL(t), 8: t => new Uint8Array(t), 9: t => new Uint16Array(t), 10: t => new Uint32Array(t) } , o = t => { let[l,e] = t; return l in i ? i[l](e) : void 0 } , a = t => t.map(o) , m = t => typeof t != "object" || t === null ? t : Object.fromEntries(Object.entries(t).map( ([l,e]) => [l, o(e)])); return m(raw)})(JSON.parse($0.getAttribute('props')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment