function arrayMap(array, iteratee) {
  var index = 0;
  var iterable = array;

  if (!Array.isArray(array)) {
    iterable = Array.from(array);
  }

  var length = iterable.length;
  var result = [];
  var resIndex = -1;

  while (index < length) {
    var value = iterable[index];
    resIndex += 1;
    result[resIndex] = iteratee(value, index, iterable);
    index += 1;
  }

  return result;
}
A specialized version of `.map` for arrays without support for callback
shorthands and `this` binding.

@param {Array} array The array to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns the new filtered array.