| OLD | NEW |
| (Empty) |
| 1 part of angular.formatter_internal; | |
| 2 | |
| 3 /** | |
| 4 * Given a Map, returns a list of items which have `key` and `value` property. | |
| 5 * | |
| 6 * Usage: | |
| 7 * | |
| 8 * <div ng-repeat="item in {'key1': 'value1', 'key2':'value2'} | arrayify"> | |
| 9 * {{item.key}}: {{item.value}} | |
| 10 * </div> | |
| 11 */ | |
| 12 @Formatter(name:'arrayify') | |
| 13 class Arrayify implements Function { | |
| 14 List<_KeyValue> call(Map inputMap) { | |
| 15 if (inputMap == null) return null; | |
| 16 List<_KeyValue> result = []; | |
| 17 inputMap.forEach((k, v) => result.add(new _KeyValue(k, v))); | |
| 18 return result; | |
| 19 } | |
| 20 } | |
| 21 | |
| 22 class _KeyValue<K, V> { | |
| 23 K key; | |
| 24 V value; | |
| 25 | |
| 26 _KeyValue(this.key, this.value); | |
| 27 } | |
| OLD | NEW |