- Preparing search index...
- The search index is not available
@nathanpb/kext
- takeIf<T, R>(receiver: T, predicate: boolean | ((it: T) => it is R) | ((it: T) => boolean)): R | undefined
-
Parameters
-
receiver: T
-
predicate: boolean | ((it: T) => it is R) | ((it: T) => boolean)
Returns R | undefined
Applies
receiver
topredicate
, returnsreceiver
if the givenpredicate
resolves intotrue
, orundefined
otherwise.If
predicate
is a boolean, returnsreceiver
cause truthy orundefined
otherwise.https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/take-if.html
Returns
receiver
ifpredicate
(or it's evaluation) istrue
.undefined
otherwise.