Clones an object, array, or string/number. If cloning an object, the keys
will be sorted.

@param value the value to clone.

@return the cloned value.
428524
function(value)
{
   var rval;
   
   if(value.constructor === Object)
   {
      rval = {};
      var keys = Object.keys(value).sort();
      for(var i in keys)
      {
         var key = keys[i];
         rval[key] = _clone(value[key]);
      }
   }
   else if(value.constructor === Array)
   {
      rval = [];
      for(var i in value)
      {
         rval[i] = _clone(value[i]);
      }
   }
   else
   {
      rval = value;
   }
   
   return rval;
}
14273
public Object[] singletonArray(Object value) {
        Object[] result = new Object[1];
        result[0] = value;
        return result;
    }
954583
public static Object[] arrayPut(final Object[] array, final int pos, final Object value){
        final Object[] ret = Arrays.copyOf(array, array.length+1);
        if(pos<array.length){
            System.arraycopy(array, pos, ret, pos+1, array.length-pos);
        }
        ret[pos] = value;
        return ret;
    }
393118
function _clone(o) {
        if (o===null || /undefined|string|number|function/.test(typeof o)) return o;
        var returnObj, v, key;
        returnObj = Array.isArray(o) ? [] : {};
        for (var key in o) {
          v = o[key];
          returnObj[key] = (typeof v === "object") ? _clone(v) : v;
        }
        return returnObj;
      }
1374707
@Override
	public String setValue(String value) {
		String result = this.value;
		this.value = value;
		calculateCompareKey();
		return result;
	}
99710
public void setValue(final Object value) {
        if (!(value instanceof Serializable)) {
            throw new IllegalArgumentException("The value muste be a instance of " + Serializable.class.getName());
        }
        this.value = (Serializable) value;
    }
93311
public EnumGene<A> newInstance(final A value) {
		return new EnumGene<>(
			_validAlleles.indexOf(value),
			_validAlleles
		);
	}
432665
public V setValue (V value)
    {
        V oldValue = _value;
        _value = value;
        return oldValue;
    }
360314
public String set(Object key, Object value) {
		Jedis jedis = getJedis();
		try {
			return jedis.set(keyToBytes(key), valueToBytes(value));
		}
		finally {close(jedis);}
	}
767569
public static Object convertToJava(Value value) {
        switch (value.getType()) {
            case STRING:
                return ((StringValue) value).get();
            case BOOLEAN:
                return ((BooleanValue) value).get();
            case NUMBER:
                return ((NumberValue) value).get();
            case DATE:
                return ((DateValue) value).get();
            case NIL:
                return null;
            case OBJECT:
                return value.get();
        }
        throw new CommandExecutionException("Could not convert value " + value + " to an equivalent Java object");
    }
918163
public ContextStack<T> copyPush(final T value) {
        final ContextStack<T> stack1 = copy();
        stack1.push(value);
        return stack1;
    }
1044201
public T value(Object... values) {
        if (values == null || values.length == 0) {
            return (T) this;
        }
        if (this.value == null) {
            this.value = new ArrayList<Object>(values.length);
        }
        if (this.value instanceof List) {
            ((List) this.value).addAll(Arrays.asList(values));
        }
        return (T) this;
    }
745800
public Object add(final Object value)
	{
		final Object key = new IdentityKey(value);
		if (!super.containsKey(key))
		{
			return super.put(key, value);
		}
		else
		{
			return null;
		}
	}
1372948
@NonNull
    @Override
    public MutableArray addValue(Object value) {
        synchronized (lock) {
            internalArray.append(Fleece.toCBLObject(value));
            return this;
        }
    }
873203
public static NfsType fromValue(int value) {
        NfsType nfsType = VALUES.get(value);
        if (nfsType == null) {
            nfsType = new NfsType(value);
            VALUES.put(value, nfsType);
        }
        return nfsType;
    }
740385
public Object call(Object value) {
        if (value == null) { return new Integer(0); }
        return new Integer(String.valueOf(value).length());
    }
606496
public static Range fromString(String value) {
        if (value == null || value.isEmpty())
            return null;
        JsArrayNumber array = JsonUtils.safeEval(value);
        return new Range(array);
    }