Class Reference

A class for References

Constructors

  • Parameters

    • reference: Reference

      the Reference in json format

    Returns Reference

    Example

    const reference = new Reference(json);
    

Properties

_internalID: string = ''

a place to store the internalID so that it does not change if the contents of the object changes

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

Accessors

  • get internalID(): string
  • create a unique id for the Reference

    Returns string

    the id

Methods

  • this function checks if References are equal

    Parameters

    Returns boolean

    true if the snaks are equal

    Example

    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

    Example

    const json = reference.toJson();
    
  • creates a new reference from snaks

    Parameters

    • snaks: Snak[]

      the snaks for the reference

    Returns Reference

    the reference objects

    Static

    Example

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

Generated using TypeDoc