ifIs()

If the first and second arguments are the same the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.

This function is valid in v2.8.0 to v2.12.3. This function has been downloaded 0 times.

Parameters

{*} subject
Value to test.
{*} control
Value that is being tested against.
{*} trueValue
Value to be returned if control and subject are the same.
{*=} opt_falseValue Optional, Default:subject
Value to be returned if control and subject are different.

Returns

{*}
trueValue will be returned if control is subject. Otherwise, if opt_falseValue is given it will be returned, but if not given subject will be returned.

Required Functions

This function directly requires the following functions which are included automatically:

  • ifFail()
    Tests subject against control and if it results in a false-ish value falsyValue will be passed back. Otherwise, if opt_truthyValue is given it will be passed back, but if not subject will be passed back.
  • ifIn()
    If the second argument is not in the first argument (array) the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifNot()
    If the first and second arguments are different the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifOut()
    If the second argument is not in the first argument (array) the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifPass()
    Tests subject against control and if it results in a true-ish value truthyValue will be passed back. Otherwise, if opt_falsyValue is given it will be passed back, but if not subject will be passed back.

Requiring Functions

This function is directly required by the following functions:

  • ifFail()
    Tests subject against control and if it results in a false-ish value falsyValue will be passed back. Otherwise, if opt_truthyValue is given it will be passed back, but if not subject will be passed back.
  • ifIn()
    If the second argument is not in the first argument (array) the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifNot()
    If the first and second arguments are different the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifOut()
    If the second argument is not in the first argument (array) the third argument is passed back, otherwise the fourth argument (or if not given the second argument) is passed back.
  • ifPass()
    Tests subject against control and if it results in a true-ish value truthyValue will be passed back. Otherwise, if opt_falsyValue is given it will be passed back, but if not subject will be passed back.