Package com.vaadin.flow.internal
Class JavaScriptSemantics
java.lang.Object
com.vaadin.flow.internal.JavaScriptSemantics
Helpers for replicating JavaScript semantics in Java.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Method Summary
-
Method Details
-
isTrueish
Gets the boolean value of the provided value, with the same rules as in JavaScript. The value can be a Java value or a JSON value:null, a JSONnulland a missing JSON value arefalse.- A Java or JSON boolean is its own value.
- A Java or JSON string is
true, except for the empty string. The string"false"is alsotrue. - A Java or JSON number is
true, except for 0 andNaN. - A JSON object or JSON array is always
true.
- Parameters:
value- the value to check for truthness- Returns:
trueif the provided value is trueish according to JavaScript semantics, otherwisefalse
-