@since 0.0.1
@author Igor Ivanovic
@function toObject

@description
Array to object conversion
516153
function toObject(arr) {
    var obj;
    if (Type.isArray(arr)) {
        obj = {};
        arr.forEach(function (item, index) {
            obj[index] = item;
        });
        return obj;
    }
    throw new Error('Core.toObject: Value is not array');
}
331405
function(o,value,fn){
       if(this.isArray(o)){
        return this._anyArray(o,value,fn);
      }
      if(this.isObject(o)){
        return this._anyObject(o,value,fn);
      }
    }
95232
public static function toArray($o)
    {
        if (is_array($o)) {
            foreach ($o as $key => $val) {
                $o[$key] = self::toArray($val);
            }
        } elseif (is_object($o) && method_exists($o, 'toArray')) {
            return $o->toArray();
        }

        return $o;
    }
324191
@SuppressWarnings("rawtypes")
    private Object[] convertToArray(Object obj) {
        // 获取参数的集合信息，并转换成数组
        Object[] values;
        if (obj instanceof Collection) {
            values = ((Collection) obj).toArray();
        } else if (obj.getClass().isArray()) {
            values = (Object[]) obj;
        } else {
            values = new Object[]{obj};
        }
        return values;
    }
834658
function array2object(array) {
    var result = {};
    array.forEach(function(e) {
        if (e) {
            var kv = e.trim().split(':');
            if (isNumber(kv[1])) {
                kv[1] = Number(kv[1]);
            } else if (isBoolean(kv[1])) {
                kv[1] = toBoolean(kv[1]);
            } else if (isDateType(kv[1])) {
                kv[1] = convert2Date(kv[1]);
            };
            result[kv[0]] = kv[1];
        };
    });
    return result;
}
1357763
function isArray(obj) {
    return (obj && typeof obj === OBJECT && typeof obj.length === NUMBER && !(obj.propertyIsEnumerable(LENGTH)));
  }
476677
@NotNull
    public Object[] toArray() {
        return toArray(new IntFunction<Object[]>() {

            @NotNull
            @Override
            public Object[] apply(int value) {
                return new Object[value];
            }
        });
    }
254767
function strArrayToObj (array) {
  return array && array.reduce(function(o, v) {
      o[v] = true;
      return o;
    }, {});
}
140674
function convertToObject(args) {
	let result = {};

	args.forEach((arg, i) => {
		if (Array.isArray(arg)) {
			result[arg[0]] = arg[1];
		} else {
			if (i % 2 === 0) {
				result[arg] = undefined;
			} else {
				result[args[i - 1]] = arg;
			}
		}
	});

	return result;
}
610343
private static Object[] convertToObjectArray(Object obj) {
        if (obj instanceof Object[]) {
            return (Object[]) obj;
        }
        int arrayLength = Array.getLength(obj);
        Object[] retArray = new Object[arrayLength];
        for (int i = 0; i < arrayLength; ++i){
            retArray[i] = Array.get(obj, i);
        }
        return retArray;
    }
65233
function(callback, ctx){
      var k = 0;

      // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
      var O = Object(this);

      var len = O.length >>> 0; 

      if ( typeof callback !== "function" ) {
        throw new TypeError( callback + " is not a function" );
      }

      // 7. Repeat, while k < len
      while( k < len ) {

        var kValue;

        if ( k in O ) {

          kValue = O[ k ];

          callback.call( ctx, kValue, k, O );
        }
        k++;
      }
    }
705205
public static function objectToArray($object = false) {

        if ($object && Validate::isObject($object)) {

            return self::objectToArrayRecursive($object);
        }

        return false;
    }
820584
public static function objectToArray($obj)
    {
        if (is_object($obj)) {
            if (method_exists($obj, 'toArray')) {
                $obj = $obj->toArray();
            } elseif (method_exists($obj, '__toArray')) {
                $obj = $obj->__toArray();
            } else {
                $obj = (array)$obj;
            }
        }
        if (is_array($obj)) {
            $new = [];
            foreach ($obj as $key => $val) {
                $new[$key] = self::objectToArray($val);
            }
        } else {
            $new = $obj;
        }

        return $new;
    }
1285589
public final function toObject(): ?array
    {
        $data = null;
        if (!empty($this->data)) {
            // no need to type-cast
            if (is_object($this->data[0])) {
                return $this->data;
            }
            $data = $this->data;
            foreach ($data as &$dat) {
                $dat = (object) $dat;
            }
        }

        return $data;
    }
677467
private static String[] fmtObjectToStrArray(Object object) {
        if (object == null) {
            return null;
        }
        if (object instanceof String[]) {
            return (String[]) object;
        }
        if (object instanceof Collection) {
            Collection c = (Collection) object;
            return (String[]) c.toArray(new String[c.size()]);
        }
        return null;
    }
263714
function(obj) {
    _.forEach(obj, function(val, key) {
      if (val && _.isFunction(val.toHexString)) {
        obj[key] = val.toHexString();
      } else if (_.isDate(val)) {
        obj[key] = val;
      } else if (_.isObject(val)) {
        if (val['$oid']) {
          obj[key] = val['$oid'];
        } else {
          obj[key] = this.uncast(val);
        }
      }
    }.bind(this));

    return obj;
  }
517767
public static Object[] toObjectArray(Object o) {

        Class clas = o.getClass().getComponentType();

        if (null == clas) return null;

        Object[] arr;

        if (clas == Boolean.TYPE) {
            boolean[] src = (boolean[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Boolean(src[i]);
        } else if (clas == Character.TYPE) {
            char[] src = (char[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Character(src[i]);
        } else if (clas == Byte.TYPE) {
            byte[] src = (byte[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Byte(src[i]);
        } else if (clas == Short.TYPE) {
            short[] src = (short[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Short(src[i]);
        } else if (clas == Integer.TYPE) {
            int[] src = (int[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Integer(src[i]);
        } else if (clas == Long.TYPE) {
            long[] src = (long[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Long(src[i]);
        } else if (clas == Float.TYPE) {
            float[] src = (float[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Float(src[i]);
        } else if (clas == Double.TYPE) {
            double[] src = (double[]) o;
            arr = new Object[src.length];
            for (int i = 0; i < src.length; i++)
                arr[i] = new Double(src[i]);
        } else {
            arr = (Object[]) o;
        }
        return arr;
    }