iwf
    Preparing search index...

    Class CommonsMediaSnak

    Class for the CommonsMediaSnak.

    Most used property of this type is P18 (image).

    Hierarchy (View Summary)

    • Snak
      • CommonsMediaSnak
    Index

    Constructors

    Properties

    datatype: string = dataType
    fileName: null | string

    The file name as used in the Wiki Commons URL

    hash: undefined | string
    property: `P${number}`
    snaktype: SnakType

    Accessors

    • Gets the link to the Wiki Commons page.

      Returns string

      The link to the Wiki Commons page.

    • get hasValue(): boolean

      Checks if the snak has a value.

      Returns boolean

      True if the snak has a value.

    • Gets the link to the image. Uses the Special:Redirect function of Wiki Commons to find the right URL.

      Returns string

      The link to the image.

    • get internalID(): string

      Creates a unique ID for the Snak.

      Returns string

      The ID.

    Methods

    • Creates a snak from a property and a file name.

      Parameters

      • property: `P${number}`

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

      • fileName: string

        The file name.

      Returns CommonsMediaSnak

      A snak with the given properties.

      const snak = CommonsMediaSnak.fromFileName('P18', 'Example.jpg');