has_value

Modified on Thu, 9 Jul at 10:50 AM

has_value

TABLE OF CONTENTS

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

Transformation
{
    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)
}
Result
{
  "true": true,
  "null": false,
  "empty": false,
  "false": false,
  "foo": true,
  "zero": false,
  "one": true,
  "minusOne": false,
  "objectA": true,
  "objectB": false
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article