The isTrue() method Return the isTrue value of an input parameter except for some predefined strings that will return false.

The regular isTrue() function from js will return true for any string provide as input argument. This words will be used to define a false value. This values are no, null, undefined, 0, off, empty, false.

Syntax

bapi.helper.isTrue(value)

Parameters

value

The value evaluated as true or false.

Return Value

A boolean value - true or false.

If input argument is a String, the method calls the IsTrue() string extension - which returns true for any string except for the following value: no,null,undefined,0,off,empty,false.

If input argument is not a String, the method runs a basic validation test and returns the result.

Example

var value = "no";
bapi.helper.isTrue(value);//False

var value = "off";
bapi.helper.isTrue(value);//False

var value = "Test Value.";
bapi.helper.isTrue(value);//True

bapi.helper.isTrue([1,2,5]);
bapi.helper.isTrue({id: 0, name: "Joe"});//True