Permalink
Browse files

Add support for arrays of arrays to @before

  • Loading branch information...
grncdr committed Apr 2, 2012
1 parent 4fdf1b5 commit dbcffd9d5e67b92ef91063001329bdebedb6e73e
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/lazorse.coffee
View
@@ -389,6 +389,13 @@ class LazyApp
i = @_stack.indexOf(existing)
if i < 0
throw new Error "Middleware #{existing} does not exist in the app"
+
+ # If we receive an array, add each sub-array in order
+ if Array.isArray(new_middle[0])
+ for nm in new_middle[0]
+ @before existing, nm...
+ return
+
if typeof new_middle[0] is 'string'
[name, args...] = new_middle
if not connect[name]?

0 comments on commit dbcffd9

Please sign in to comment.