/** ECMA 11.8.5. Returns true, false, or undefined. */
public static Value lessThan(Session session, Value x, Value y)
{
x = safeValue(x, Isolate.DEFAULT_ID);
y = safeValue(y, Isolate.DEFAULT_ID);
Value px = toPrimitive(session, x, PreferredType.NUMBER, x.getIsolateId());
Value py = toPrimitive(session, y, PreferredType.NUMBER, y.getIsolateId());
if (px.getType() == VariableType.STRING
&& py.getType() == VariableType.STRING)
{
String sx = px.getValueAsString();
String sy = py.getValueAsString();
return DValue.forPrimitive(new Boolean(sx.compareTo(sy) < 0), x.getIsolateId());
}
else
{
double dx = toNumber(session, px);