Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "json"

Index

Functions

normalizeJSON

  • normalizeJSON(value: string, aligned?: boolean): string
  • 删除 JSON 字符串中的注释和末尾多余的逗号

    Parameters

    • value: string

      要处理的字符串

    • Default value aligned: boolean = true

      如果为 true 则将注释替换为等长空格而非删除

    Returns string

readJSON

  • readJSON(path: string): any
  • 同步读取指定的 JSON 文件,忽略其中的注释和末尾多余的逗号

    Parameters

    • path: string

      要读取的文件路径

    Returns any

writeJSON

  • writeJSON(path: string, data: any): void
  • 同步保存指定的 JSON 文件

    Parameters

    • path: string

      要保存的文件路径

    • data: any

      要保存的 JSON 数据

    Returns void

Generated using TypeDoc