Class Reference

A class for References.

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • reference: Reference

      The Reference in JSON format.

    Returns Reference

    const reference = new Reference(json);
    

Properties

hash: undefined | string
snaks: Snak[]
snaksOrder: undefined | string[]

Accessors

  • get internalID(): string
  • Creates a unique ID for the Reference.

    Returns string

    The ID.

Methods

  • Checks if References are equal.

    Parameters

    Returns boolean

    True if the References are equal.

    const reference = Reference.fromSnaks([
    new Snak('P123', 'Q42'),
    new Snak('P456', 'Q43')
    ]);

    const reference2 = Reference.fromSnaks([
    new Snak('P123', 'Q42')
    ]);

    reference.equals(reference2); // false
  • Returns Reference

    The Reference in a JSON format.

    const json = reference.toJSON();
    
  • Creates a new Reference from snaks.

    Parameters

    • snaks: Snak[]

      The snaks for the Reference.

    Returns Reference

    The Reference object.

    const reference = Reference.fromSnaks([
    new Snak('P123', 'Q42'),
    new Snak('P456', 'Q43')
    ]);