OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library shelf.util; | 5 library shelf.util; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// Returns a [Map] with the values from [original] and the values from | 31 /// Returns a [Map] with the values from [original] and the values from |
32 /// [updates]. | 32 /// [updates]. |
33 /// | 33 /// |
34 /// For keys that are the same between [original] and [updates], the value in | 34 /// For keys that are the same between [original] and [updates], the value in |
35 /// [updates] is used. | 35 /// [updates] is used. |
36 /// | 36 /// |
37 /// If [updates] is `null` or empty, [original] is returned unchanged. | 37 /// If [updates] is `null` or empty, [original] is returned unchanged. |
38 Map updateMap(Map original, Map updates) { | 38 Map updateMap(Map original, Map updates) { |
39 if (updates == null || updates.isEmpty) return original; | 39 if (updates == null || updates.isEmpty) return original; |
40 | 40 |
41 return new Map.from(original) | 41 return new Map.from(original)..addAll(updates); |
42 ..addAll(updates); | |
43 } | 42 } |
OLD | NEW |