| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 library mojom.utils; | 5 library mojom.utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return 0; | 127 return 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 /// Is any element of [haystack] a prefix of [needle]? | 130 /// Is any element of [haystack] a prefix of [needle]? |
| 131 bool containsPrefix(String needle, List<String> haystack) { | 131 bool containsPrefix(String needle, List<String> haystack) { |
| 132 if (haystack == null) return false; | 132 if (haystack == null) return false; |
| 133 var match = | 133 var match = |
| 134 haystack.firstWhere((p) => needle.startsWith(p), orElse: () => null); | 134 haystack.firstWhere((p) => needle.startsWith(p), orElse: () => null); |
| 135 return match != null; | 135 return match != null; |
| 136 } | 136 } |
| OLD | NEW |