url(params, options) {
    let args = params;
    const url = this.path.replace(/\(\.\*\)/g, '');

    if (typeof params !== 'object') {
      args = Array.prototype.slice.call(arguments);
      if (typeof args[args.length - 1] === 'object') {
        options = args[args.length - 1];
        args = args.slice(0, -1);
      }
    }

    const toPath = compile(url, { encode: encodeURIComponent, ...options });
    let replaced;

    const tokens = parse(url);
    let replace = {};

    if (Array.isArray(args)) {
      for (let len = tokens.length, i = 0, j = 0; i < len; i++) {
        if (tokens[i].name) replace[tokens[i].name] = args[j++];
      }
    } else if (tokens.some((token) => token.name)) {
      replace = params;
    } else if (!options) {
      options = params;
    }

    replaced = toPath(replace);

    if (options && options.query) {
      replaced = parseUrl(replaced);
      if (typeof options.query === 'string') {
        replaced.search = options.query;
      } else {
        replaced.search = undefined;
        replaced.query = options.query;
      }

      return formatUrl(replaced);
    }

    return replaced;
  }
Generate URL for route using given `params`.

@example

```javascript
const route = new Layer('/users/:id', ['GET'], fn);

route.url({ id: 123 }); // => "/users/123"
```

@param {Object} params url parameters
@returns {String}
@private