return unchanged if array passed, otherwise wrap in an array
@param  {Object|Array|Null} arr any object
@return {Array}
544460
function ensureAnArray (arr) {
        if (Object.prototype.toString.call(arr) === '[object Array]') {
            return arr;
        } else if (arr === null || arr === void 0) {
            return [];
        } else {
            return [arr];
        }
    }
255656
function findValueInArray(arr){
	let valueObj = {};
	for (let i = 0; i < arr.length; i++) {
		if (arr[i]) {
			valueObj = arr[i];
		}
	}

	return valueObj;
}
212234
function some(arr, iter) {
    arr = Immutable.List(arr);

    return arr.reduce(function(prev, elem, i) {
        return prev.then(function(val) {
            if (val) return val;

            return iter(elem, i);
        });
    }, Q());
}
76503
function _eachArrayReverse(arry, fn) {
  let ret = true
  for (let i = arry.length - 1; i >= 0; i--) {
    ret = fn(arry[i], i, arry)
    if (ret === false) {
      break
    }
  }
  return ret
}
152526
function(array, fn)
	{
		if (array != null && fn != null)
		{
			for (var i = 0; i < array.length; i++)
			{
				fn(array[i]);
			}
		}
		
		return array;
	}
688153
function(arr) {
        return {
            min: Math.min.apply(null, arr),
            max: Math.max.apply(null, arr)
        };
    }
61447
function(arr) {
  arr = arr.sort((a, b) => {
    if (a.index > b.index) {
      return 1;
    }
    if (a.index === b.index) {
      return 0;
    }
    return -1;
  });
  //return ts objects
  return arr.map((o) => o.ts);
}
110329
function arrayIncludes(arr, v) {
  for (let i = 0, len = arr.length; i < len; i++) {
    const av = arr[i];

    if (Tyr.isEqual(av, v)) {
      return true;
    }
  }

  return false;
}
499157
function (arr, val) {
    if (!arr || arr.length === 0) return {}

    let o = {}
    let v = val || null

    if (arr.length > 1)
      v = this.fromArray(arr.slice(1), v)

    o[arr[0]] = v
    return o
  }
252116
public static boolean isStringArrayEmpty(String[] arr) {
        boolean empty = true;
        if (arr != null) {
            if (arr.length > 0) {
                for (String s : arr) {
                    if (StringUtils.isNotBlank(s)) {
                        empty = false;
                        break;
                    }
                }
            }
        }
        return empty;
    }
1039929
function prev(array, item) {
  if (array && array.length && item) {
    const idx = array.indexOf(item);
    return idx === -1 ? null : array[idx - 1];
  }
  return null;
}
70724
function(attr) {
			var newArr = [];

			if (this.arr.length === undefined) {
				// The wrapped array is a JSON object
				for (var key in arr) {
					newArr.push(this.arr[key][attr]);
				}
			} else {
				// The wrapped array is an array
				for (var i = 0, l = this.arr.length; i < l; i++) {
					newArr.push(this.arr[i][attr]);
				}
			}

			return stats(newArr);
		}
953029
def wrap_in_array(object)
      if object.nil?
        []
      elsif object.respond_to?(:to_ary)
        object.to_ary || [object]
      else
        [object]
      end
    end
54781
function(arr, f) {
      var r = [];
      for (var i = 0; i < arr.length; i++) {
        var x = arr[i];
        if (x.isSome()) {
          r.push(x.getOrDie());
        } else {
          return Option.none();
        }
      }
      return Option.some(f.apply(null, r));
    }
1107860
function(arr, func) {
	
	if (arr.map) { return arr.map(func); }
	
	var i, l,
		r = [];
	
	for (i=0, l=arr.length; i<l; i++) {
		r.push(func(arr[i]));
	}
	return r;
}
696283
function sum (arr) {
    if (isArray(arr) && !(arr[0] instanceof Array)) {
        const filteredNumber = getFilteredValues(arr);
        const totalSum = filteredNumber.length ?
                            filteredNumber.reduce((acc, curr) => acc + curr, 0)
                            : InvalidAwareTypes.NULL;
        return totalSum;
    }
    return InvalidAwareTypes.NULL;
}
1025950
function clone(arr) {
              	var newArr = [];
              	for (var i=0; i<arr.length; i++) {
              		newArr.push(arr[i]);
              	}
              	return newArr;
              }