{"id":13902764,"url":"https://github.com/alii/azs","last_synced_at":"2025-04-05T20:03:47.405Z","repository":{"id":45233513,"uuid":"421079916","full_name":"alii/azs","owner":"alii","description":"🤓 Amplify Zod schemas with methods","archived":false,"fork":false,"pushed_at":"2024-01-14T16:54:32.000Z","size":1923,"stargazers_count":328,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T02:32:15.896Z","etag":null,"topics":["method","node","struct","ts","typescript","zod"],"latest_commit_sha":null,"homepage":"https://alistair.sh","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alii.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-25T15:27:30.000Z","updated_at":"2024-06-09T20:31:17.176Z","dependencies_parsed_at":"2024-06-09T20:41:12.829Z","dependency_job_id":null,"html_url":"https://github.com/alii/azs","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":0.5,"last_synced_commit":"233ff5287c8076bb90bcc8f06cf50046181e86df"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":"alii/tsnt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alii%2Fazs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alii%2Fazs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alii%2Fazs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alii%2Fazs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alii","download_url":"https://codeload.github.com/alii/azs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393551,"owners_count":20931811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["method","node","struct","ts","typescript","zod"],"created_at":"2024-08-06T22:01:23.246Z","updated_at":"2025-04-05T20:03:47.368Z","avatar_url":"https://github.com/alii.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","typescript"],"sub_categories":[],"readme":"# azs\n\nazs allows you to add virtual methods to zod schemas, tying data types to functions. here's a small example for a `user` type.\n\nA more advanced example can be found [here](./example/basic.ts).\n\n```ts\nimport {z} from 'zod';\nimport {azs} from 'azs';\n\nconst userSchema = z.object({\n\tage: z.number(),\n\tname: z.string(),\n\tgithub: z.string().url(),\n});\n\nconst schema = azs(userSchema, {\n\t// Basic example\n\tisAdult: user =\u003e {\n\t\treturn user.age \u003e= 18;\n\t},\n\n\t// Methods can take arguments, but the\n\t// first argument will always be the parsed\n\t// value. You don't have to specify a type\n\t// for the first argument.\n\tis: (user, name: string) =\u003e {\n\t\treturn user.name === name;\n\t},\n\n\t// Or, you can access `this` which will be\n\t// the parsed value. Notice how this is a\n\t// method, not an arrow function property.\n\tgetName() {\n\t\treturn this.name;\n\t},\n});\n\nconst user = schema.parse(someRandomJSONThatMightBeAUser);\n\nuser.isAdult();\nuser.getName();\nuser.is('Colin McDonnell');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falii%2Fazs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falii%2Fazs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falii%2Fazs/lists"}