is.true
is.true(target: unknown)โ
The is.true
method is used to determine whether a given value is equal to the boolean true
. It returns true if the value is equal to true
, and false otherwise.
Specificationโ
- Target argument: required.
- Checks if the given "target" type is true.
Informationโ
- Unit tests: โ
Examplesโ
is.true(true) // true
is.true(new Boolean(1)) // true
is.true(new Boolean(-1)) // true
is.true(false) // false
is.true(new Boolean(0)) // false
is.true(new Boolean()) // false
is.true(0) // false
is.true('') // false
is.true({}) // false
is.true([]) // false
// And all other known types will return false
Reversal boolean resultโ
is.not_true(true) // false
is.not_true(new Boolean(1)) // false
is.not_true(new Boolean(-1)) // false
is.not_true(false) // true
is.not_true(new Boolean(0)) // true
is.not_true(new Boolean()) // true
is.not_true(0) // true
is.not_true('') // true
is.not_true({}) // true
is.not_true([]) // true
// And all other known types will return true