lib/sortedArray.js
function sortedIndex(element) {
    /* jshint validthis:true */
    var index = binarySearch(toArray(this), element, this.comparator);

    if (index < 0) {
        // binarySearch decreases the negative index by one because otherwise the index 0 would stand for two results
        // @see https://github.com/darkskyapp/binary-search/issues/1
        return Math.abs(index) - 1;
    } else {
        return index;
    }
}
function sortedIndex(element) {
    /* jshint validthis:true */
    var index = binarySearch(toArray(this), element, this.comparator);

    if (index < 0) {
        // binarySearch decreases the negative index by one because otherwise the index 0 would stand for two results
        // @see https://github.com/darkskyapp/binary-search/issues/1
        return Math.abs(index) - 1;
    } else {
        return index;
    }
}
function sortedIndex ( element ) { /* jshint validthis:true */ var index = binarySearch ( toArray ( this ) , element , this . comparator ) ; if ( index < 0 ) { // binarySearch decreases the negative index by one because otherwise the index 0 would stand for two results // @see https://github.com/darkskyapp/binary-search/issues/1 return Math . abs ( index ) - 1 ; } else { return index ; } }
Returns the index where the given element would be inserted.

@param {*} element
@returns {Number}
Returns the index where the given element would be inserted .