X Tutup
Skip to content

Commit e67ebb7

Browse files
committed
feat(core): improve stringify for dart to handle closures
1 parent 3524946 commit e67ebb7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/angular2/src/facade/lang.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ bool isPromise(obj) => obj is Future;
3030
bool isNumber(obj) => obj is num;
3131
bool isDate(obj) => obj is DateTime;
3232

33-
String stringify(obj) => obj.toString();
33+
String stringify(obj) {
34+
final exp = new RegExp(r"from Function '(\w+)'");
35+
final str = obj.toString();
36+
if (exp.firstMatch(str) != null) {
37+
return exp.firstMatch(str).group(1);
38+
} else {
39+
return str;
40+
}
41+
}
3442

3543
int serializeEnum(val) {
3644
return val.index;

0 commit comments

Comments
 (0)
X Tutup