{"id":21461444,"url":"https://github.com/berhalak/dressup","last_synced_at":"2025-03-17T04:49:11.741Z","repository":{"id":57216268,"uuid":"237979479","full_name":"berhalak/dressup","owner":"berhalak","description":"Typescript decorators","archived":false,"fork":false,"pushed_at":"2020-03-05T22:05:24.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T15:11:40.367Z","etag":null,"topics":["typescript","typescript-decorators","typescript-library"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berhalak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-03T14:05:41.000Z","updated_at":"2020-03-05T22:05:26.000Z","dependencies_parsed_at":"2022-08-26T13:31:38.288Z","dependency_job_id":null,"html_url":"https://github.com/berhalak/dressup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Fdressup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Fdressup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Fdressup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berhalak%2Fdressup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berhalak","download_url":"https://codeload.github.com/berhalak/dressup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976503,"owners_count":20377692,"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":["typescript","typescript-decorators","typescript-library"],"created_at":"2024-11-23T07:09:11.839Z","updated_at":"2025-03-17T04:49:11.721Z","avatar_url":"https://github.com/berhalak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dressup\nTypescript decorators\n\n``` ts\nimport { mix, decorate } from \"dressup\"\n\ntest('decorator demo', () =\u003e {\n\tclass Base {\n\t\tconstructor(private num: number = null) {\n\n\t\t}\n\t\tbaseMethod() {\n\t\t\treturn this.num;\n\t\t}\n\t}\n\n\t@decorate()\n\tclass Derive extends Base {\n\t\tconstructor(private inner: Base) {\n\t\t\tsuper(null);\n\t\t}\n\n\t\tderiveMethod() {\n\t\t\treturn this.baseMethod() + 2;\n\t\t}\n\t}\n\n\tconst bob = new Derive(new Base(10));\n\n\texpect(bob.baseMethod()).toBe(10);\n\texpect(bob.deriveMethod()).toBe(12);\n})\n\ntest('mix demo', () =\u003e {\n\tclass Rename {\n\t\trename(name: string) {\n\t\t\t(this as any).name = name;\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tclass Printable {\n\t\tprint() {\n\t\t\treturn (this as any).name;\n\t\t}\n\t}\n\n\tclass Model extends mix(Rename, Printable) {\n\t\tname = \"test\";\n\t}\n\n\texpect(new Model().print()).toBe(\"test\");\n\texpect(new Model().rename(\"hello\").print()).toBe(\"hello\");\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberhalak%2Fdressup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberhalak%2Fdressup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberhalak%2Fdressup/lists"}