Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created June 11, 2024 06:13
Show Gist options
  • Save ThaddeusJiang/09bd33637327daac4134786bced0a0b7 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/09bd33637327daac4134786bced0a0b7 to your computer and use it in GitHub Desktop.
JavaScript single-file application
// install npm package
async function install() {
const z = await import("zod")
return { z }
}
async function main() {
const { z } = await install()
const result = z.string().datetime().safeParse("2021-01-01T00:00:00Z")
console.log(result)
}
main()
// {
// success: true,
// data: "2021-01-01T00:00:00Z"
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment