Inserts an item into a sorted array, returning a new array.
let data = [ 1, 2, 3, 4 ];data = insert(data, 2.5);// [ 1, 2, 2.5, 3, 4 ] Copy
let data = [ 1, 2, 3, 4 ];data = insert(data, 2.5);// [ 1, 2, 2.5, 3, 4 ]
By default uses Javascript comparision semantics. Passing in comparer is needed when working with an array of objects.
comparer
Sorted array
Data to insert
Comparer, uses JS default semantics if not specified.
Inserts an item into a sorted array, returning a new array.
By default uses Javascript comparision semantics. Passing in
comparer
is needed when working with an array of objects.