decorated-json:使用@decorators将JSON与ES类相互转换

时间:2021-03-19 03:12:25
【文件属性】:
文件名称:decorated-json:使用@decorators将JSON与ES类相互转换
文件大小:190KB
文件格式:ZIP
更新时间:2021-03-19 03:12:25
serialization typescript decorators TypeScript 装饰JSON 使用装饰器将JSON转换为类并返回。使用简单易用的修饰符为数据类添加注释,然后将标准JSON解析为实际的类实例。为了获得更多的类型安全性和更少的语法,建议与一起使用, 是用于装饰器元数据的ES7 Reflection API的原型。 通过无缝集成到现有代码中,超轻量级语法 安全地将标准JSON解析为类实例,而无需在源JSON中指定任何类型信息 安装 使用以下方法安装: yarn add decorated-json 或者 npm install decorated-json 可选:安装以获得附加的类型安全性和减少的语法要求。 reflect-metadata必须全局可用才能工作。通常可以使用import 'reflect-metadata'完成此操作。 如何使用 DecoratedJSON使用装饰器,并要求您的类使用@jsonObject进行注释,并使用@jsonPrope
【文件预览】:
decorated-json-master
----nyc.config.js(164B)
----ava.default.config.js(358B)
----package.json(3KB)
----.github()
--------workflows()
----ava.no-reflect-metadata.config.js(341B)
----ava.no-emit-decorator-metadata.config.js(376B)
----LICENSE(1KB)
----.eslintrc.yaml(1018B)
----src()
--------helpers.ts(4KB)
--------json-object.ts(950B)
--------decorated-json.ts(2KB)
--------json-property.ts(4KB)
--------diagnostics.ts(4KB)
--------type-handler.ts(5KB)
--------types.ts(195B)
--------errors()
--------options-base.ts(1KB)
--------type-descriptor()
--------util()
--------json-handler.ts(2KB)
--------index.ts(781B)
--------metadata.ts(6KB)
----tsconfig.json(720B)
----spec()
--------no-emit-decorator-metadata()
--------no-reflect-metadata()
--------utils()
--------default()
--------helpers()
----.gitignore(255B)
----tsconfig()
--------tsconfig.app.json(101B)
--------tsconfig.bundle.types.json(308B)
--------tsconfig.app-strict.json(104B)
--------tsconfig.app-base.json(90B)
--------tsconfig.bundle.esm.json(196B)
--------tsconfig.bundle.esm5.json(194B)
--------tsconfig.spec.json(198B)
--------tsconfig.spec-strict.json(155B)
--------tsconfig.base.json(446B)
--------tsconfig.bundle.cjs.json(164B)
--------tsconfig.lint.json(118B)
--------README.md(2KB)
----README.md(10KB)
----yarn.lock(318KB)
----.editorconfig(278B)
----.gitattributes(2KB)
----lint-staged.config.js(297B)

网友评论