Interface HVal

The interface for a haystack value.

Each haystack encoded value should declare a static factory 'make' method used for creating values. All constructors should be kept private (or protected).

interface HVal {
    compareTo(value: unknown): number;
    equals(value: unknown): boolean;
    getKind(): Kind;
    inspect(message?: string): this;
    isKind(kind: Kind): boolean;
    matches(filter: string | Node, cx?: Partial<EvalContext>): boolean;
    newCopy(): HVal;
    toAxon(): string;
    toDict(): HDict;
    toFilter(): string;
    toGrid(): HGrid;
    toJSON(): HaysonVal;
    toJSONString(): string;
    toJSONUint8Array(): Uint8Array;
    toJSONv3(): JsonV3Val;
    toList(): HList;
    toString(): string;
    toZinc(nested?: boolean): string;
}

Implemented by

Methods

  • Compares two numbers.

    Parameters

    • value: unknown

      The value to compare against.

    Returns number

    The sort order as negative, 0, or positive

  • Value equality check.

    Parameters

    • value: unknown

      The value used to check for equality.

    Returns boolean

    True if the value is the same.

  • Dump the value to the local console output.

    Parameters

    • Optionalmessage: string

      An optional message to display before the value.

    Returns this

    The value instance.

  • Compares the value's kind.

    Parameters

    • kind: Kind

      The kind to compare against.

    Returns boolean

    True if the kind matches.

  • Returns true if the haystack filter matches the value.

    Parameters

    • filter: string | Node

      The filter to test.

    • Optionalcx: Partial<EvalContext>

      Optional haystack filter evaluation context.

    Returns boolean

    True if the filter matches ok.

  • Returns a new copy of the underlying value.

    If the value is immutable, the value will simply return itself. If mutable, the value will return a brand new copy of the value.

    Returns HVal

    A value.

  • Returns string

    An Axon encoded representation of the value.

  • Encodes to an encoded zinc value that can be used in a haystack filter string.

    The encoding for a haystack filter is mostly zinc but contains some exceptions.

    Returns string

    The encoded value that can be used in a haystack filter.

  • Returns string

    A string containing the JSON representation of the object.

  • Returns Uint8Array

    A byte buffer that has an encoded JSON string representation of the object.

  • Returns string

    A string representation of the value.

  • Encodes to an encoding zinc value.

    Parameters

    • Optionalnested: boolean

      An optional flag used to indiciate whether the value being encoded is nested.

    Returns string

    The encoded zinc string.