@extra-array/insert
Version:
Inserts a value to an ordered array.
14 lines (12 loc) • 315 B
JavaScript
const insert$ = require('./insert$');
/**
* Inserts a value to an ordered array.
* @param {Iterable} x an array
* @param {*} v value to insert
* @param {function?} fn compare function (a, b)
* @returns {Array}
*/
function insert(x, v, fn) {
return insert$(Array.from(x), v, fn);
}
module.exports = insert;