Skip to content

Commit

Permalink
chore: use rest params (#1393)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinovyatkin authored and dead-horse committed Oct 14, 2019
1 parent 66c1593 commit ef5c43b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 4 additions & 5 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,14 @@ module.exports = {
*
* this.is('html'); // => false
*
* @param {String|Array} types...
* @param {String|String[]} [type]
* @param {String[]} [types]
* @return {String|false|null}
* @api public
*/

is(types) {
if (!types) return typeis(this.req);
if (!Array.isArray(types)) types = [].slice.call(arguments);
return typeis(this.req, types);
is(type, ...types) {
return typeis(this.req, type, ...types);
},

/**
Expand Down
10 changes: 4 additions & 6 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,14 @@ module.exports = {
* Check whether the response is one of the listed types.
* Pretty much the same as `this.request.is()`.
*
* @param {String|Array} types...
* @param {String|String[]} [type]
* @param {String[]} [types]
* @return {String|false}
* @api public
*/

is(types) {
const type = this.type;
if (!types) return type || false;
if (!Array.isArray(types)) types = [].slice.call(arguments);
return typeis(type, types);
is(type, ...types) {
return typeis(this.type, type, ...types);
},

/**
Expand Down

0 comments on commit ef5c43b

Please sign in to comment.