Class JavaScriptSemantics


  • public class JavaScriptSemantics
    extends Object
    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 Detail

      • isTrueish

        public static boolean isTrueish​(Object value)
        Gets the boolean value of the provided value:
        • null is false.
        • String values are true, except for the empty string.
        • Numerical values are true, except for 0 and NaN.
        • JSON object and JSON array values are always true.
        Parameters:
        value - the value to check for truthness
        Returns:
        true if the provided value is trueish according to JavaScript semantics, otherwise false