Skip to main content

Class: Document

Defined in: document.d.ts:8

Document corresponds to a single YAML document. Note that even though a YAML file can contain multiple documents, each one of these documents is represented by a separate Document object.

Indexable

[customProperties: string]: any

This declaration allows setting and getting custom properties on the document without TypeScript compiler errors.

Constructors

Constructor

new Document(): Document;

Defined in: document.d.ts:10

Creates a new empty document.

Returns

Document

Constructor

new Document(content): Document;

Defined in: document.d.ts:13

Creates a new document with the given content. Content must be a valid YAML string or a JavaScript object.

Parameters

ParameterType
contentstring | Object

Returns

Document

Properties

PropertyTypeDescriptionDefined in
apiVersion?stringThe API version of the document.document.d.ts:42
group?DocumentGroupThe document group this document belongs to.document.d.ts:22
kind?stringThe kind of the document.document.d.ts:47
metadata?ObjectMetaThe metadata of the document.document.d.ts:52

Methods

fullPath()

fullPath(): string;

Defined in: document.d.ts:31

Returns the file path to write the document into. Adds group name as base directory if it is not null.

Returns

string


getPath()

getPath(): string;

Defined in: document.d.ts:25

Returns the file path to the document. May contain multiple segments separated by slashes.

Returns

string


provisionAfter()

provisionAfter(other): void;

Defined in: document.d.ts:34

Apply and wait for this document after the given document. Documents must be in the same group.

Parameters

ParameterType
otherDocument

Returns

void


provisionBefore()

provisionBefore(other): void;

Defined in: document.d.ts:37

Apply and wait for this document before the given document. Documents must be in the same group.

Parameters

ParameterType
otherDocument

Returns

void


setPath()

setPath(path): void;

Defined in: document.d.ts:28

Sets the file path to the document. May contain multiple segments separated by slashes.

Parameters

ParameterType
pathstring

Returns

void