truthy checks shouldn't drop type info
This commit is contained in:
@@ -222,10 +222,10 @@ class Prelude {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static dynamic function truthy(v:Any) {
|
public static dynamic function truthy<T>(v:T) {
|
||||||
return switch (Type.typeof(v)) {
|
return switch (Type.typeof(v)) {
|
||||||
case TNull: false;
|
case TNull: false;
|
||||||
case TBool: (v : Bool);
|
case TBool: cast(v, Bool);
|
||||||
default:
|
default:
|
||||||
// Empty strings are falsy
|
// Empty strings are falsy
|
||||||
if (v.isOfType(String)) {
|
if (v.isOfType(String)) {
|
||||||
|
Reference in New Issue
Block a user