@types/js-yaml

  • Version 4.0.9
  • Published
  • 9.12 kB
  • No dependencies
  • MIT license

Install

npm i @types/js-yaml
yarn add @types/js-yaml
pnpm add @types/js-yaml

Overview

TypeScript definitions for js-yaml

Index

Variables

variable CORE_SCHEMA

let CORE_SCHEMA: Schema;
  • same as JSON_SCHEMA: http://www.yaml.org/spec/1.2/spec.html#id2804923

variable DEFAULT_SCHEMA

let DEFAULT_SCHEMA: Schema;
  • all supported YAML types

variable FAILSAFE_SCHEMA

let FAILSAFE_SCHEMA: Schema;
  • only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346

variable JSON_SCHEMA

let JSON_SCHEMA: Schema;
  • only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346

Functions

function dump

dump: (obj: any, opts?: DumpOptions) => string;

    function load

    load: (str: string, opts?: LoadOptions) => unknown;

      function loadAll

      loadAll: {
      (str: string, iterator?: null, opts?: LoadOptions): unknown[];
      (str: string, iterator: (doc: unknown) => void, opts?: LoadOptions): void;
      };

        Classes

        class Schema

        class Schema {}

          constructor

          constructor(definition: SchemaDefinition | Type | Type[]);

            method extend

            extend: (types: SchemaDefinition | Type[] | Type) => Schema;

              class Type

              class Type {}

                constructor

                constructor(tag: string, opts?: TypeConstructorOptions);

                  property defaultStyle

                  defaultStyle: string;

                    property instanceOf

                    instanceOf: {};

                      property kind

                      kind: 'sequence' | 'scalar' | 'mapping';

                        property multi

                        multi: boolean;

                          property predicate

                          predicate: (data: object) => boolean;

                            property represent

                            represent: ((data: object) => any) | { [x: string]: (data: object) => any };

                              property representName

                              representName: (data: object) => any;

                                property styleAliases

                                styleAliases: { [x: string]: any };

                                  method construct

                                  construct: (data: any, type?: string) => any;

                                    method resolve

                                    resolve: (data: any) => boolean;

                                      class YAMLException

                                      class YAMLException extends Error {}

                                        constructor

                                        constructor(reason?: string, mark?: Mark);

                                          property mark

                                          mark: Mark;

                                            property message

                                            message: string;

                                              property name

                                              name: string;

                                                property reason

                                                reason: string;

                                                  method toString

                                                  toString: (compact?: boolean) => string;

                                                    Interfaces

                                                    interface DumpOptions

                                                    interface DumpOptions {}

                                                      property condenseFlow

                                                      condenseFlow?: boolean | undefined;
                                                      • if true flow sequences will be condensed, omitting the space between key: value or a, b. Eg. '[a,b]' or {a:{b:c}}. Can be useful when using yaml for pretty URL query params as spaces are %-encoded. (default: false).

                                                      property flowLevel

                                                      flowLevel?: number | undefined;
                                                      • specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere

                                                      property forceQuotes

                                                      forceQuotes?: boolean | undefined;
                                                      • if true, all non-key strings will be quoted even if they normally don't need to. (default: false)

                                                      property indent

                                                      indent?: number | undefined;
                                                      • indentation width to use (in spaces).

                                                      property lineWidth

                                                      lineWidth?: number | undefined;
                                                      • set max line width. (default: 80)

                                                      property noArrayIndent

                                                      noArrayIndent?: boolean | undefined;
                                                      • when true, will not add an indentation level to array elements

                                                      property noCompatMode

                                                      noCompatMode?: boolean | undefined;
                                                      • if true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 (default: false)

                                                      property noRefs

                                                      noRefs?: boolean | undefined;
                                                      • if true, don't convert duplicate objects into references (default: false)

                                                      property quotingType

                                                      quotingType?: "'" | '"' | undefined;
                                                      • strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters. (default: ')

                                                      property replacer

                                                      replacer?: ((key: string, value: any) => any) | undefined;
                                                      • callback function (key, value) called recursively on each key/value in source object (see replacer docs for JSON.stringify).

                                                      property schema

                                                      schema?: Schema | undefined;
                                                      • specifies a schema to use.

                                                      property skipInvalid

                                                      skipInvalid?: boolean | undefined;
                                                      • do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.

                                                      property sortKeys

                                                      sortKeys?: boolean | ((a: any, b: any) => number) | undefined;
                                                      • if true, sort keys when dumping YAML. If a function, use the function to sort the keys. (default: false)

                                                      property styles

                                                      styles?: { [x: string]: any } | undefined;
                                                      • Each tag may have own set of styles. - "tag" => "style" map.

                                                      interface LoadOptions

                                                      interface LoadOptions {}

                                                        property filename

                                                        filename?: string | undefined;
                                                        • string to be used as a file path in error/warning messages.

                                                        property json

                                                        json?: boolean | undefined;
                                                        • compatibility with JSON.parse behaviour.

                                                        property schema

                                                        schema?: Schema | undefined;
                                                        • specifies a schema to use.

                                                        method listener

                                                        listener: (this: State, eventType: EventType, state: State) => void;
                                                        • listener for parse events

                                                        method onWarning

                                                        onWarning: (this: null, e: YAMLException) => void;
                                                        • function to call on warning messages.

                                                        interface Mark

                                                        interface Mark {}

                                                          property buffer

                                                          buffer: string;

                                                            property column

                                                            column: number;

                                                              property line

                                                              line: number;

                                                                property name

                                                                name: string;

                                                                  property position

                                                                  position: number;

                                                                    property snippet

                                                                    snippet: string;

                                                                      interface SchemaDefinition

                                                                      interface SchemaDefinition {}

                                                                        property explicit

                                                                        explicit?: Type[] | undefined;

                                                                          property implicit

                                                                          implicit?: Type[] | undefined;

                                                                            interface State

                                                                            interface State {}

                                                                              property checkLineBreaks

                                                                              checkLineBreaks: boolean;

                                                                                property filename

                                                                                filename: string | null;

                                                                                  property implicitTypes

                                                                                  implicitTypes: Type[];

                                                                                    property input

                                                                                    input: string;

                                                                                      property json

                                                                                      json: boolean;

                                                                                        property kind

                                                                                        kind: string;

                                                                                          property length

                                                                                          length: number;

                                                                                            property line

                                                                                            line: number;

                                                                                              property lineIndent

                                                                                              lineIndent: number;

                                                                                                property lineStart

                                                                                                lineStart: number;

                                                                                                  property onWarning

                                                                                                  onWarning: (this: null, e: YAMLException) => void;

                                                                                                    property position

                                                                                                    position: number;

                                                                                                      property result

                                                                                                      result: any;

                                                                                                        property schema

                                                                                                        schema: Schema;

                                                                                                          property version

                                                                                                          version: null | number;

                                                                                                            interface TypeConstructorOptions

                                                                                                            interface TypeConstructorOptions {}

                                                                                                              property construct

                                                                                                              construct?: ((data: any, type?: string) => any) | undefined;

                                                                                                                property defaultStyle

                                                                                                                defaultStyle?: string | undefined;

                                                                                                                  property instanceOf

                                                                                                                  instanceOf?: object | undefined;

                                                                                                                    property kind

                                                                                                                    kind?: 'sequence' | 'scalar' | 'mapping' | undefined;

                                                                                                                      property multi

                                                                                                                      multi?: boolean | undefined;

                                                                                                                        property predicate

                                                                                                                        predicate?: ((data: object) => boolean) | undefined;

                                                                                                                          property represent

                                                                                                                          represent?:
                                                                                                                          | ((data: object) => any)
                                                                                                                          | { [x: string]: (data: object) => any }
                                                                                                                          | undefined;

                                                                                                                            property representName

                                                                                                                            representName?: ((data: object) => any) | undefined;

                                                                                                                              property resolve

                                                                                                                              resolve?: ((data: any) => boolean) | undefined;

                                                                                                                                property styleAliases

                                                                                                                                styleAliases?: { [x: string]: any } | undefined;

                                                                                                                                  Type Aliases

                                                                                                                                  type EventType

                                                                                                                                  type EventType = 'open' | 'close';

                                                                                                                                    Package Files (1)

                                                                                                                                    Dependencies (0)

                                                                                                                                    No dependencies.

                                                                                                                                    Dev Dependencies (0)

                                                                                                                                    No dev dependencies.

                                                                                                                                    Peer Dependencies (0)

                                                                                                                                    No peer dependencies.

                                                                                                                                    Badge

                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/js-yaml.

                                                                                                                                    • Markdown
                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/js-yaml)
                                                                                                                                    • HTML
                                                                                                                                      <a href="https://www.jsdocs.io/package/@types/js-yaml"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>