MCPcopy Create free account
hub / github.com/Snapchat/Valdi / asInt

Method asInt

valdi/src/java/com/snap/valdi/utils/JSConversions.kt:53–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 fun asInt(any: Any?): Int {
54 if (any is Number) {
55 return any.toInt()
56 } else if (any is String) {
57 return any.toInt()
58 }
59
60 throw AttributeError("value $any is not an int")
61 }
62
63 fun asLong(any: Any?): Long {
64 if (any is Number) {

Callers 1

jsonValueToValueFunction · 0.80

Calls 2

AttributeErrorClass · 0.85
toIntMethod · 0.45

Tested by

no test coverage detected