Vinyl
    Preparing search index...

    Function sortedInsertionIndex

    • Given an array using the given comparator function, finds the insertion index of an element.

      Type Parameters

      • T
      • U = T

      Parameters

      • array: ArrayLike<T>

        An array sorted using the comparator.

      • element: U

        The element to compare against array elements.

      • comparator: Comparator<U, T>

        A function where given the return value of comparator(element, array[i]) if less than zero the returned index will be before i, otherwise after.

      • start: number = 0

        The starting index (inclusive). Default: 0

      • end: number = array.length

        The ending index (exclusive). Default: array.length

      Returns number