Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/pkg/angular/lib/formatter/arrayify.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/formatter/arrayify.dart
diff --git a/third_party/pkg/angular/lib/formatter/arrayify.dart b/third_party/pkg/angular/lib/formatter/arrayify.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e38bc1a34cd849d39ff5666bb6a2ef0a0c4f6303
--- /dev/null
+++ b/third_party/pkg/angular/lib/formatter/arrayify.dart
@@ -0,0 +1,27 @@
+part of angular.formatter_internal;
+
+/**
+ * Given a Map, returns a list of items which have `key` and `value` property.
+ *
+ * Usage:
+ *
+ * <div ng-repeat="item in {'key1': 'value1', 'key2':'value2'} | arrayify">
+ * {{item.key}}: {{item.value}}
+ * </div>
+ */
+@Formatter(name:'arrayify')
+class Arrayify implements Function {
+ List<_KeyValue> call(Map inputMap) {
+ if (inputMap == null) return null;
+ List<_KeyValue> result = [];
+ inputMap.forEach((k, v) => result.add(new _KeyValue(k, v)));
+ return result;
+ }
+}
+
+class _KeyValue<K, V> {
+ K key;
+ V value;
+
+ _KeyValue(this.key, this.value);
+}
« no previous file with comments | « third_party/pkg/angular/lib/filter/uppercase.dart ('k') | third_party/pkg/angular/lib/formatter/currency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698