Function isSenseString

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

    Parameters

    • string_: string

      The string to test.

    Returns string_ is `L${number}-S${number}`

    True if the string is a SenseString.

    const property = 'L123-S4';
    if (!isSenseString(property)) {
    throw new Error('Not a SenseString');
    }
    WikibaseSenseSnak.fromID(property);