js-yaml - v5.3.0
    Preparing search index...

    Interface ScalarTagOptions<Result>

    Options for defineScalarTag.

    interface ScalarTagOptions<Result> {
        implicit?: boolean;
        matchByTagPrefix?: boolean;
        implicitFirstChars?: readonly string[] | null;
        resolve: (
            source: string,
            isExplicit: boolean,
            tagName: string,
        ) => typeof NOT_RESOLVED | Result;
        identify: (data: any) => boolean;
        represent?: (data: any) => string;
        representTagName?: (data: any) => string;
    }

    Type Parameters

    • Result
    Index

    Whether this tag participates in resolving plain scalars without an explicit tag. Default: false.

    Whether explicit tag names are matched by prefix instead of exact equality. Default: false.

    Set of source.charAt(0) keys for which resolve may succeed (a superset of what it really matches). A key is either a single character or '' (empty source). null means "no constraint, always try". Used by the composer to dispatch implicit scalars by first character without running every resolver.

    Construct a value from scalar text, or return NOT_RESOLVED when it is invalid for this tag. isExplicit is true for an explicit tag and tagName is the actual matched name.

    Selects this tag for a JavaScript value when dumping. Use () => false for load-only tags.

    A scalar's printed form is text, so represent always yields a string. The factory supplies a String(data) default when a tag omits it.

    Return the tag name to emit for a prefix-matching tag. Defaults to tagName.