Function isQString

  • Tests if a string is a QString. Can also be used as a type guard.

    Parameters

    • string_: string

      The string to test.

    Returns string_ is `Q${number}`

    True if the string is a QString.

    const id = 'Q123';
    if (!isQString(id)) {
    throw new Error('Not a QString');
    }
    WikibaseItemSnak.fromID('P42', id);