JSPM

@zhanghongping/jsonsage-demo

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q16169F
    • License MIT

    Demo and examples for jsonsage workflow system

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zhanghongping/jsonsage-demo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      JsonSage 示例演示

      这个目录包含了 JsonSage 的示例代码,展示了主要功能的使用方法。

      运行示例

      1. 确保你已经安装了所有依赖:
      npm install
      1. 运行验证示例:
      npx ts-node basic-example.ts
      1. 运行转换示例:
      npx ts-node transform-example.ts

      示例说明

      basic-example.ts

      这个示例展示了 JSON Schema 验证功能:

      • 定义 JSON Schema
      • 验证有效和无效的 JSON 数据
      • 获取详细的验证错误信息

      transform-example.ts

      这个示例展示了 JSON 转换功能:

      • 自定义转换规则(大写、添加前缀、数值计算等)
      • 处理嵌套对象和数组
      • 类型安全的转换操作

      示例输出说明

      每个示例运行后都会:

      1. 显示原始数据
      2. 显示处理后的结果
      3. 将完整示例保存到 JSON 文件中(demo-data.jsontransform-demo.json

      注意事项

      • 确保你的 TypeScript 环境已经正确配置
      • 示例中使用的是相对路径引入,确保你在正确的目录下运行命令
      • 所有示例都包含了详细的错误处理和类型检查