Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "project/util/jsonUtils"

Index

Type aliases

Variables

Functions

Type aliases

JsonManipulation

JsonManipulation<M>: (jsonObj: M) => void

Type parameters

  • M = any

Type declaration

    • (jsonObj: M): void
    • Parameters

      • jsonObj: M

      Returns void

Variables

Const spacePossibilities

spacePossibilities: (string | number)[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, " ", " ", "\t"]

Functions

doWithJson

  • doWithJson<M, P>(p: P, jsonPath: string, manipulation: JsonManipulation<M>): Promise<P>
  • Manipulate the contents of the given JSON file within the project, using its object form and writing back using the same formatting. See the manipulate function.

    Type parameters

    Parameters

    • p: P
    • jsonPath: string

      JSON file path. This function will do nothing without error if the file is ill-formed or not found.

    • manipulation: JsonManipulation<M>

    Returns Promise<P>

manipulate

  • manipulate<M>(jsonIn: string, manipulation: JsonManipulation<M>, context?: string): string
  • Update the object form of the given JSON content and write it back with minimal changes

    Type parameters

    • M = any

    Parameters

    • jsonIn: string
    • manipulation: JsonManipulation<M>
    • Default value context: string = ""

    Returns string

Generated using TypeDoc