OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 deep_equals; | 5 library deep_equals; |
6 | 6 |
7 /// Returns whether two objects are structurally equivalent. This considers NaN | 7 /// Returns whether two objects are structurally equivalent. This considers NaN |
8 /// values to be equivalent. It also handles self-referential structures. | 8 /// values to be equivalent. It also handles self-referential structures. |
9 bool deepEquals(obj1, obj2, [List parents1, List parents2]) { | 9 bool deepEquals(obj1, obj2, [List parents1, List parents2]) { |
10 if (identical(obj1, obj2)) return true; | 10 if (identical(obj1, obj2)) return true; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 /// Returns whether two doubles are equivalent. This differs from `d1 == d2` in | 67 /// Returns whether two doubles are equivalent. This differs from `d1 == d2` in |
68 /// that it considers NaN to be equal to itself. | 68 /// that it considers NaN to be equal to itself. |
69 bool _doubleEquals(double d1, double d2) { | 69 bool _doubleEquals(double d1, double d2) { |
70 if (d1.isNaN && d2.isNaN) return true; | 70 if (d1.isNaN && d2.isNaN) return true; |
71 return d1 == d2; | 71 return d1 == d2; |
72 } | 72 } |
OLD | NEW |