iwf
    Preparing search index...

    Class URLSnak

    Class for the URLSnak.

    Most used property of this type is P854 (reference URL).

    Hierarchy (View Summary)

    Index
    • Parameters

      • snak: {
            datatype?: "url";
            datavalue?: { type: "string"; value: string };
            hash?: string;
            property: string;
            snaktype: "value" | "somevalue" | "novalue";
        }

        The snak for this class in JSON format.

      Returns URLSnak

      If the input does not match this datatype's Wikidata schema.

      const snak = new URLSnak(json);
      
    datatype: string = 'url'
    hash: string | undefined
    property: `P${number}`
    snaktype: "value" | "somevalue" | "novalue"
    url: string | undefined
    • get hasValue(): boolean

      Checks if the snak has a value.

      Returns boolean

      True if the snak has a value.

    • get internalID(): string

      Creates a unique ID for the Snak.

      Returns string

      The ID.

    • get value(): string | undefined

      The value will be URL encoded.

      Returns string | undefined

      The value of the snak.

      url

    • set value(value: string | undefined): void

      Parameters

      • value: string | undefined

        The value of the snak.

      Returns void

      url

    • This function checks if two snaks are equal.

      Parameters

      Returns boolean

      True if the snaks are equal.

      if (urlSnak.equals(other)) {
      // do something
      }
    • Returns {
          datatype?: "url";
          datavalue?: { type: "string"; value: string };
          hash?: string;
          property: string;
          snaktype: "value" | "somevalue" | "novalue";
      }

      The snak as JSON.

      const json = urlSnak.toJSON();
      
    • Parameters

      • property: `P${number}`

        The property of the snak in 'P-form'.

      • url: string

        The URL.

      Returns URLSnak

      A snak with the given properties.

      const snak = URLSnak.fromURL('P854', 'https://example.com');