Vinyl
    Preparing search index...

    Interface AttributeRule<T>

    A rule definition for an attribute.

    interface AttributeRule<T> {
        default: undefined | T;
        localPart: undefined | string;
        namespaceUri: null | string;
        parse: (value: string) => T;
        required: boolean;
        stringify: (value: NonNullable<T>) => string;
        type: ATTRIBUTE;
    }

    Type Parameters

    • T

    Hierarchy

    Index

    Properties

    default: undefined | T

    If the current element has no matching attribute, default will be used.

    localPart: undefined | string

    Matches the QName.localPart of the element. If undefined, this will match against the property name from XmlRules.

    namespaceUri: null | string

    Matches the namespaceUri of the attribute.

    If null, this will only match against a null namespace.

    Note that attributes do not inherit default namespaces as elements do.

    parse: (value: string) => T

    Parses the attribute value.

    required: boolean

    If true, a parsing error will be thrown if the value is undefined.

    stringify: (value: NonNullable<T>) => string

    Stringifies the value.

    type: ATTRIBUTE