We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { defineContext, defineExtension } from "es-codec" interface Logger { log(...args : any[]): void } const { encode, decode } = defineContext<Logger>().createCodec([ defineExtension({ name: "URL", when(x): x is URL { return x.constructor === URL }, encode(url, context) { context.log("encoding url", url) return url.href }, decode(href, context) { context.log("decoding url", href) return new URL(href) } }) ]) const encodedUrl = encode(new URL("https://example.com"), console) const decodedUrl = decode(encodedURL, console)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Basic Usage
The text was updated successfully, but these errors were encountered: