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 11library facade.collection;
22
33import 'dart:collection' show IterableBase, Iterator;
4+ import 'dart:convert' show JsonEncoder;
45export 'dart:core' show Map, List, Set;
56import 'dart:math' show max, min;
67
8+ var jsonEncoder = new JsonEncoder ();
9+
710class MapIterator extends Iterator <List > {
811 final Iterator _iterator;
912 final Map _map;
@@ -170,6 +173,10 @@ class ListWrapper {
170173 }
171174 }
172175
176+ static String toJSON (List l) {
177+ return jsonEncoder.convert (l);
178+ }
179+
173180 // JS splice, slice, fill functions can take start < 0 which indicates a position relative to
174181 // the end of the list
175182 static int _startOffset (List l, int start) {
Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ export class ListWrapper {
238238 }
239239 }
240240 static toString < T > ( l : List < T > ) : string { return l . toString ( ) ; }
241+ static toJSON < T > ( l : List < T > ) : string { return JSON . stringify ( l ) ; }
242+
241243}
242244
243245export function isListLikeIterable ( obj ) : boolean {
You can’t perform that action at this time.
0 commit comments