feat(core): improve stringify for dart to handle closures
This commit is contained in:
parent
3524946581
commit
e67ebb7f70
|
@ -30,7 +30,15 @@ bool isPromise(obj) => obj is Future;
|
|||
bool isNumber(obj) => obj is num;
|
||||
bool isDate(obj) => obj is DateTime;
|
||||
|
||||
String stringify(obj) => obj.toString();
|
||||
String stringify(obj) {
|
||||
final exp = new RegExp(r"from Function '(\w+)'");
|
||||
final str = obj.toString();
|
||||
if (exp.firstMatch(str) != null) {
|
||||
return exp.firstMatch(str).group(1);
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
int serializeEnum(val) {
|
||||
return val.index;
|
||||
|
|
Loading…
Reference in New Issue