| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /** | 5 /** |
| 6 * Pattern utilities for use with server.Router. | 6 * Pattern utilities for use with server.Router. |
| 7 * | 7 * |
| 8 * Example: | 8 * Example: |
| 9 * | 9 * |
| 10 * var router = new Router(server); | 10 * var router = new Router(server); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 /// return the tail | 72 /// return the tail |
| 73 Match prefixMatch(Pattern pattern, String str) { | 73 Match prefixMatch(Pattern pattern, String str) { |
| 74 Iterable<Match> matches = pattern.allMatches(str); | 74 Iterable<Match> matches = pattern.allMatches(str); |
| 75 if (!matches.isEmpty && matches.first.start == 0) { | 75 if (!matches.isEmpty && matches.first.start == 0) { |
| 76 return matches.first; | 76 return matches.first; |
| 77 } | 77 } |
| 78 return null; | 78 return null; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool _hasMatch(Iterable<Match> matches) => matches.iterator.moveNext(); | 81 bool _hasMatch(Iterable<Match> matches) => matches.iterator.moveNext(); |
| OLD | NEW |