From e67ebb7f70a6f4b782665dc2a4cc53a4c70ea016 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 15 Dec 2015 14:29:35 -0800 Subject: [PATCH] feat(core): improve stringify for dart to handle closures --- modules/angular2/src/facade/lang.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/facade/lang.dart b/modules/angular2/src/facade/lang.dart index bebddc051d..9323bff237 100644 --- a/modules/angular2/src/facade/lang.dart +++ b/modules/angular2/src/facade/lang.dart @@ -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;