This commit is contained in:
thosakwe 2017-01-11 20:57:26 -05:00
parent df9d407c22
commit 00104b67ef
3 changed files with 6 additions and 4 deletions

View file

@ -1,6 +1,6 @@
# angel_route # angel_route
![version 1.0.0-dev+19](https://img.shields.io/badge/version-1.0.0--dev+19-red.svg) ![version 1.0.0](https://img.shields.io/badge/version-1.0.0-brightgreen.svg)
![build status](https://travis-ci.org/angel-dart/route.svg) ![build status](https://travis-ci.org/angel-dart/route.svg)
A powerful, isomorphic routing library for Dart. A powerful, isomorphic routing library for Dart.

View file

@ -60,6 +60,8 @@ class Router extends Extensible {
/// Prepends the given middleware to any routes created /// Prepends the given middleware to any routes created
/// by the resulting router. /// by the resulting router.
/// ///
/// [middleware] can be either an `Iterable`, or a single object.
///
/// The resulting router can be chained, too. /// The resulting router can be chained, too.
_ChainedRouter chain(middleware) => new _ChainedRouter(this, middleware); _ChainedRouter chain(middleware) => new _ChainedRouter(this, middleware);
@ -412,7 +414,7 @@ class _ChainedRouter extends Router {
_ChainedRouter(Router root, middleware) { _ChainedRouter(Router root, middleware) {
this._root = root; this._root = root;
_handlers.add(middleware); _handlers.addAll(middleware is Iterable ? middleware : [middleware]);
} }
@override @override
@ -436,7 +438,7 @@ class _ChainedRouter extends Router {
final piped = new _ChainedRouter.empty().._root = _root; final piped = new _ChainedRouter.empty().._root = _root;
piped._handlers.addAll([] piped._handlers.addAll([]
..addAll(_handlers) ..addAll(_handlers)
..add(middleware)); ..addAll(middleware is Iterable ? middleware : [middleware]));
return piped; return piped;
} }
} }

View file

@ -1,6 +1,6 @@
name: angel_route name: angel_route
description: A powerful, isomorphic routing library for Dart. description: A powerful, isomorphic routing library for Dart.
version: 1.0.0-dev+19 version: 1.0.0
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_route homepage: https://github.com/angel-dart/angel_route
dev_dependencies: dev_dependencies: