Skip to content

Commit

Permalink
feat(core): improve stringify for dart to handle closures
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Dec 17, 2015
1 parent 3524946 commit e67ebb7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/angular2/src/facade/lang.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e67ebb7

Please sign in to comment.