Skip to content

Instantly share code, notes, and snippets.

View markGilchrist's full-sized avatar
🎯
Focusing

Mark Gilchrist markGilchrist

🎯
Focusing
View GitHub Profile
@markGilchrist
markGilchrist / guard.kt
Last active January 19, 2022 10:04
Guard let for Kotlin
@file:Suppress("unused")
package com.gameforeverything.guard
/**
* This function will return a value as per the mapper function @see [block]
* if all the parameters supplied are non null and the condition is true
*
* @param condition this defaults to true
* @param block a function that return a instance of a type if the condition is tr