This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const f = (a: any[], b: any[]): any[] => | |
[].concat(...a.map(a2 => b.map(b2 => [].concat(a2, b2)))); | |
export const cartesianProduct = (a: any[], b: any[], ...c: any[]) => { | |
if (!b || b.length === 0) { | |
return a; | |
} | |
const [b2, ...c2] = c; | |
const fab = f(a, b); | |
return cartesianProduct(fab, b2, c2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.gson.* | |
import java.math.BigDecimal | |
import java.math.BigInteger | |
/** | |
* Created by Terence Baker on 13/02/2018. | |
*/ | |
val JsonElement.optString: String? | |
get() = safeConversion { asString } |