Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -28,6 +28,16 @@ class CoolUtil
|
||||
public static function getLastExceptionStack():String {
|
||||
return CallStack.toString(CallStack.exceptionStack());
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns `v` if not null
|
||||
* @param v The value
|
||||
* @return A bool value
|
||||
*/
|
||||
public static inline function isNotNull(v:Null<Dynamic>):Bool {
|
||||
return v != null && !isNaN(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns `v` if not null, `defaultValue` otherwise.
|
||||
* @param v The value
|
||||
@@ -135,7 +145,7 @@ class CoolUtil
|
||||
|
||||
/**
|
||||
* Returns a string representation of a size, following this format: `1.02 GB`, `134.00 MB`
|
||||
* @param size Size to convert ot string
|
||||
* @param size Size to convert to string
|
||||
* @return String Result string representation
|
||||
*/
|
||||
public static function getSizeString(size:Float):String {
|
||||
@@ -149,6 +159,15 @@ class CoolUtil
|
||||
return '${Std.int(rSize) + "." + addZeros(Std.string(Std.int((rSize % 1) * 100)), 2)}${labels[label]}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces in a string any kind of IP with `[Your IP]` making the string safer to trace.
|
||||
* @param msg String to check and edit
|
||||
* @return String Result without any kind of IP
|
||||
*/
|
||||
public static inline function removeIP(msg:String):String {
|
||||
return ~/\d+.\d+.\d+.\d+/.replace(msg, "[Your IP]"); // For now its just IPs but who knows in the future.. - Nex_isDumb
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternative linear interpolation function for each frame use, without worrying about framerate changes.
|
||||
* @param v1 Begin value
|
||||
|
||||
Reference in New Issue
Block a user