feat(core): improve stringify for dart to handle closures

This commit is contained in:
vsavkin 2015-12-15 14:29:35 -08:00 committed by Victor Savkin
parent 3524946581
commit e67ebb7f70
1 changed files with 9 additions and 1 deletions

View File

@ -30,7 +30,15 @@ bool isPromise(obj) => obj is Future;
bool isNumber(obj) => obj is num; bool isNumber(obj) => obj is num;
bool isDate(obj) => obj is DateTime; 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) { int serializeEnum(val) {
return val.index; return val.index;