has_value

Evaluate argument as bool

Definition

bool has_value(any $entry)

Returns true if $entry is truthy and false if it's falsy. Equivalent to if($entry, `true`, `false`)

Parameters

any $entry

Argument to evaluate the truthfulness of.

Returns

boolean

true if $entry is truthy and false if it's falsy.

Examples

{
    true: has_value(`true`),
    null: has_value(`null`),
    empty: has_value(''),
    false: has_value('false'),
    foo: has_value('foo'),
    zero: has_value(`0`),
    one: has_value(`1`),
    minusOne: has_value(`-1.5`),
    objectA: has_value({"a": 'foo'}.a),
    objectB: has_value({"a": 'foo'}.b)
}
 {
  "true": true,
  "null": false,
  "empty": false,
  "false": false,
  "foo": true,
  "zero": false,
  "one": true,
  "minusOne": false,
  "objectA": true,
  "objectB": false
}