toolish - v0.2.5
    Preparing search index...

    Function mirrorIndex

    • If the given index is negative, it is assumed to count back from the given limit (e.g. array length), and is translated as such. E.g. -1 becomes limit - 1 and so on. If the given index is positive, it is returned as is.

      NOTE that no attempt is made to cap the resulting index in any way, it may even be negative again if the given index is larger than the limit. You can use normalizeRangeStart and normalizeRangeEnd for that.

      Parameters

      • index: number
      • limit: number

      Returns number