lib/scope.js
function loadScopes(scopes) {
  var scopeMapping = {};
  if (typeof scopes === 'object') {
    for (var s in scopes) {
      var routes = [];
      var entries = scopes[s];
      debug('Scope: %s routes: %j', s, entries);
      if (Array.isArray(entries)) {
        for (var j = 0, k = entries.length; j < k; j++) {
          var route = entries[j];
          if (typeof route === 'string') {
            routes.push({methods: ['all'], path: route,
              regexp: pathToRegexp(route, [], {end: false})});
          } else {
            var methods = helpers.normalizeList(methods);
            if (methods.length === 0) {
              methods.push('all');
            }
            methods = methods.map(toLowerCase);
            routes.push({methods: methods,
              path: route.path,
              regexp: pathToRegexp(route.path, [], {end: false})});
          }
        }
      } else {
        debug('Routes must be an array: %j', entries);
      }
      scopeMapping[s] = routes;
    }
  } else if (typeof scopes === 'string') {
    scopes = helpers.normalizeList(scopes);
    for (var i = 0, n = scopes.length; i < n; i++) {
      scopeMapping[scopes[i]] = [
        {methods: 'all', path: '/.+', regexp: /\/.+/}
      ];
    }
  }
  return scopeMapping;
}
function loadScopes(scopes) {
  var scopeMapping = {};
  if (typeof scopes === 'object') {
    for (var s in scopes) {
      var routes = [];
      var entries = scopes[s];
      debug('Scope: %s routes: %j', s, entries);
      if (Array.isArray(entries)) {
        for (var j = 0, k = entries.length; j < k; j++) {
          var route = entries[j];
          if (typeof route === 'string') {
            routes.push({methods: ['all'], path: route,
              regexp: pathToRegexp(route, [], {end: false})});
          } else {
            var methods = helpers.normalizeList(methods);
            if (methods.length === 0) {
              methods.push('all');
            }
            methods = methods.map(toLowerCase);
            routes.push({methods: methods,
              path: route.path,
              regexp: pathToRegexp(route.path, [], {end: false})});
          }
        }
      } else {
        debug('Routes must be an array: %j', entries);
      }
      scopeMapping[s] = routes;
    }
  } else if (typeof scopes === 'string') {
    scopes = helpers.normalizeList(scopes);
    for (var i = 0, n = scopes.length; i < n; i++) {
      scopeMapping[scopes[i]] = [
        {methods: 'all', path: '/.+', regexp: /\/.+/}
      ];
    }
  }
  return scopeMapping;
}
function loadScopes ( scopes ) { var scopeMapping = { } ; if ( typeof scopes === 'object' ) { for ( var s in scopes ) { var routes = [ ] ; var entries = scopes [ s ] ; debug ( 'Scope: %s routes: %j' , s , entries ) ; if ( Array . isArray ( entries ) ) { for ( var j = 0 , k = entries . length ; j < k ; j ++ ) { var route = entries [ j ] ; if ( typeof route === 'string' ) { routes . push ( { methods : [ 'all' ] , path : route , regexp : pathToRegexp ( route , [ ] , { end : false } ) } ) ; } else { var methods = helpers . normalizeList ( methods ) ; if ( methods . length === 0 ) { methods . push ( 'all' ) ; } methods = methods . map ( toLowerCase ) ; routes . push ( { methods : methods , path : route . path , regexp : pathToRegexp ( route . path , [ ] , { end : false } ) } ) ; } } } else { debug ( 'Routes must be an array: %j' , entries ) ; } scopeMapping [ s ] = routes ; } } else if ( typeof scopes === 'string' ) { scopes = helpers . normalizeList ( scopes ) ; for ( var i = 0 , n = scopes . length ; i < n ; i ++ ) { scopeMapping [ scopes [ i ] ] = [ { methods : 'all' , path : '/.+' , regexp : / \/.+ / } ] ; } } return scopeMapping ; }
Load the definition of scopes

```json
{
"scope1": [{"methods": "get", path: "/:user/profile"}, "/order"],
"scope2": [{"methods": "post", path: "/:user/profile"}]
}
```
@param {Object} scopes
@returns {Object}
Load the definition of scopes