Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/yaml"

Index

Functions

arrayIndent

  • arrayIndent(y: string, indentArray: boolean | undefined): string
  • Remove superfluous indentation from array if indentArray is false.

    Parameters

    • y: string

      YAML document as string

    • indentArray: boolean | undefined

      retain indented arrays if true

    Returns string

    YAML document as string with arrays indented as desired.

formatYaml

  • formatYaml(obj: any, options?: Options): string
  • Format object into a YAML string.

    Parameters

    • obj: any

      object to serialize

    • Default value options: Options = { keepArrayIndent: false }

      settings for the formatting

    Returns string

formatYamlKey

  • formatYamlKey(key: string, value: any, options?: Options): string
  • Format a key and value into a YAML string.

    Parameters

    • key: string

      key to serialize

    • value: any

      value to serialize

    • Default value options: Options = { keepArrayIndent: false }

      settings for the formatting

    Returns string

knownType

  • knownType(a: any): boolean

simpleType

  • simpleType(a: any): boolean

updateYamlDocument

  • updateYamlDocument(updates: object, currentYaml: string, options?: Options): string
  • Use the keys in the provided object to update, insert, or delete keys in the provided YAML document.

    Parameters

    • updates: object

      object of updates

      • [key: string]: any
    • currentYaml: string

      YAML document to update

    • Default value options: Options = { keepArrayIndent: false }

      format settings

    Returns string

    updated YAML document as a string

updateYamlDocumentWithString

  • updateYamlDocumentWithString(updatesString: string, currentYaml: string, options?: Options): string
  • Parse the provides update string as JSON and use the keys in the provided object to update, insert, or delete keys in the provided YAML.

    Parameters

    • updatesString: string
    • currentYaml: string

      YAML document to update

    • Default value options: Options = { keepArrayIndent: false }

      format settings

    Returns string

    updated YAML document as a string

updateYamlDocuments

  • updateYamlDocuments(updates: object, yamlDocuments: string, options?: Options): string
  • Use the keys in the provided object to update, insert, or delete keys in the provided YAML. The YAML can be multiple documents.

    The updating follows two possible strategies depending on the ̀updateAlloption. Whenfalse, the default, if the keys are found in any of the documents, they are updated in the first document the key exists in. If a key is not found in any document, it is added to the first document. WheǹupdateAllistrue`, the updates append on all documents.

    Parameters

    • updates: object

      object of updates

      • [key: string]: any
    • yamlDocuments: string
    • Default value options: Options = { keepArrayIndent: false, updateAll: false }

      format settings

    Returns string

    updated YAML document as a string

updateYamlKey

  • updateYamlKey(key: string, value: any, currentYaml: string, options?: Options): string
  • Update, insert, or delete the value of a key in currentYml, a string containing valid YAML. It does its best to retain the same formatting, but empty lines and trailing whitespace may disappear if adjacent lines are edited and comments that are parsed as part of a value that is deleted will be deleted.

    Parameters

    • key: string

      the key whose value should be replaced

    • value: any

      the value to set the key to, set to null or undefined to remove the key

    • currentYaml: string
    • Default value options: Options = { keepArrayIndent: false }

      settings for the formatting

    Returns string

    updated YAML document as a string

Generated using TypeDoc