javascript - lodash _.sortedIndex returns last index element -
i'm using lodash _.sortedindex
determine position element should go.
if array being checked small enough works perfectly. array can grow quite large , after has increased size _.sortedindex
returns last element of array instead of actual position
var checkobject = {name: john, lastname: doe} var arrayofobjects = [1...25]; //the objects similar layout checkobject var position = _.sortedindex(arrayofobjects, checkobject, 'name')
this works fine, , position returned appropriate spot.
however in instance below:
var checkobject = {name: john, lastname: doe} var arrayofobjects = [1...75]; //the objects similar layout checkobject var position = _.sortedindex(arrayofobjects, checkobject, 'name')
it seems either return correct position or return 76
is there way ensure returned position correct?
this call called function inside angular using following:
$scope.$evalasync( function (data) { somefunctiontocheckindex(data) } );
Comments
Post a Comment