{"id":21898293,"url":"https://github.com/AirPowerTeam/AirPower-Transformer","last_synced_at":"2025-07-21T13:31:35.784Z","repository":{"id":225474411,"uuid":"766102525","full_name":"HammCn/AirPower","owner":"HammCn","description":"🔥🔥🔥AirPower, 一个基于TypeScript的开发工具包, 内置了数据转换、装饰器、时间日期处理、加解密与散列、文件处理、常用枚举和字典、常见数据结构处理等工具。","archived":false,"fork":false,"pushed_at":"2024-08-28T07:26:14.000Z","size":134,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-07T14:44:50.984Z","etag":null,"topics":["airpower","library","toolkit","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/airpower","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/HammCn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2024-03-02T10:49:28.000Z","updated_at":"2024-10-16T05:37:46.000Z","dependencies_parsed_at":"2024-05-09T04:29:03.896Z","dependency_job_id":"d3a6e69b-ff72-45bb-a425-9dc399595201","html_url":"https://github.com/HammCn/AirPower","commit_stats":null,"previous_names":["hammcn/airpower"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HammCn%2FAirPower","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HammCn%2FAirPower/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HammCn%2FAirPower/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HammCn%2FAirPower/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HammCn","download_url":"https://codeload.github.com/HammCn/AirPower/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226930740,"owners_count":17704973,"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":["airpower","library","toolkit","typescript"],"created_at":"2024-11-28T14:25:25.977Z","updated_at":"2025-07-21T13:31:35.772Z","avatar_url":"https://github.com/HammCn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"300\" src=\"./assets/airpower-bg.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/AirPowerTeam/AirPower-Transformer\"\u003eGithub\u003c/a\u003e /\n\u003ca href=\"https://gitee.com/air-power/AirPower-Transformer\"\u003eGitee\u003c/a\u003e /\n\u003ca href=\"https://www.npmjs.com/package/@airpower/transformer\"\u003eNPM\u003c/a\u003e\n\u003c/p\u003e\n\n# 🎉 项目介绍\n\n**AirPower-Transformer** 是一个基于 `TypeScript` 的数据转换器，提供了从 `JSON` 对象到 `类实例` 对象之间互相转换的系列装饰器和方法。\n\n# 💻 如何安装\n\n```shell\nnpm install @airpower/transformer\n# or\nyarn add @airpower/transformer\n# or\ncnpm install @airpower/transformer\n# or ...\n```\n\n# 📖 使用说明\n\n```ts\nimport { IgnorePrefix, Prefix, Transformer, Type } from '@airpower/transformer'\n\n@Prefix('role____')\nclass Role extends Transformer {\n  id!: number\n  name!: string\n}\n\n@Prefix('user_')\nclass User extends Transformer {\n  id!: number\n  name!: string\n\n  @IgnorePrefix()\n  age!: number\n\n  @Type(Role)\n  role!: Role\n\n  @Type(Role, true)\n  roleList: Role[] = []\n}\n\nconst user = new User()\nuser.id = 1\nuser.name = 'Hamm'\nuser.age = 18\n\nconst role = new Role()\nrole.name = 'Admin'\nuser.role = role\n\nconst roleItem = new Role()\nroleItem.name = 'User'\nuser.roleList.push(roleItem)\n\nconst json = user.copy().toJson()\nconsole.warn('json', JSON.stringify(json))\n\njson.name = '???' // 无效\nconst user2 = User.fromJson(json)\nconsole.warn('user2', user2)\n```\n\n# ⏰ 欢迎反馈\n\n如有疑问，可以通过本仓库的 **Issues** 与我们联系，如果你有一些代码贡献，可以通过 **Pull Request** 将代码贡献，为这个项目添砖加瓦。\n\n如果有更多的需求和建议，欢迎通过本仓库的 `Issues` 提出，也欢迎加入 QQ群 555156313 与我们及时反馈。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAirPowerTeam%2FAirPower-Transformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAirPowerTeam%2FAirPower-Transformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAirPowerTeam%2FAirPower-Transformer/lists"}