Is there a better way to write insertion sort?
Other than rewriting it in a less pseudo-code-like way:

const insertion = ( array ) =&gt; {

    if(!Array.isArray(array))
        throw new Error("array must be an Array");

    if (array.length === 0)
        return [];

    //shallow copy
    const clonedArray = array.slice();

    //Optimized iterative version: https://en.wikipedia.org/wiki/Insertion_sort
    let temp;
    for (let i = 1; i &lt; clonedArray.length; i++) {
      temp = clonedArray[i];
      for (let j = i-1; j &gt;= 0 &amp;&amp; clonedArray[j] &gt; temp; j--) {
        clonedArray[j + 1] = clonedArray[j];
      }
      clonedArray[j + 1] = temp;
    }

    return clonedArray;
};

module.exports = insertion;


There isn't much room for improvement from an algorithm perspective, since you're already using the optimized algorithm and you aren't doing anything unnecessary from a JavaScript perspective.

Rewriting it to use for() instead of while() won't have any real effect, other than it just looks less like pseudo-code and more like typical JS. It is really just a code style thing though, and open to opinion.

(Also, dropped isFunction() since you don't seem to use it, but that might just be copy-pasta from the rest of your code.)