All files / server/utils/normalize index.js

100% Statements 2/2
100% Branches 9/9
100% Functions 1/1
100% Lines 1/1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18        401x                          
// First parameter can be:
// - path: String
// - options: Number || Object (cannot be ID'd)
// - middleware: undefined || null || Boolean || Function || Array
module.exports = middle => (typeof middle[0] === 'string') ? ({
  path: middle.shift(), opts: {}, middle
}) : (
  typeof middle[0] === 'undefined' ||
  typeof middle[0] === 'boolean' ||
  middle[0] === null ||
  middle[0] instanceof Function ||
  middle[0] instanceof Array
) ? ({
    path: '*', opts: {}, middle
  }) : ({
    path: '*', opts: middle.shift(), middle
  });