File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
modules/angular2/src/facade Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 1
1
library facade.collection;
2
2
3
3
import 'dart:collection' show IterableBase, Iterator;
4
+ import 'dart:convert' show JsonEncoder;
4
5
export 'dart:core' show Map, List, Set;
5
6
import 'dart:math' show max, min;
6
7
8
+ var jsonEncoder = new JsonEncoder ();
9
+
7
10
class MapIterator extends Iterator <List > {
8
11
final Iterator _iterator;
9
12
final Map _map;
@@ -170,6 +173,10 @@ class ListWrapper {
170
173
}
171
174
}
172
175
176
+ static String toJSON (List l) {
177
+ return jsonEncoder.convert (l);
178
+ }
179
+
173
180
// JS splice, slice, fill functions can take start < 0 which indicates a position relative to
174
181
// the end of the list
175
182
static int _startOffset (List l, int start) {
Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ export class ListWrapper {
238
238
}
239
239
}
240
240
static toString < T > ( l : List < T > ) : string { return l . toString ( ) ; }
241
+ static toJSON < T > ( l : List < T > ) : string { return JSON . stringify ( l ) ; }
242
+
241
243
}
242
244
243
245
export function isListLikeIterable ( obj ) : boolean {
You can’t perform that action at this time.
0 commit comments