chore: use rest params (#1393)

This commit is contained in:
Konstantin Vyatkin
2019-10-13 23:19:07 -04:00
committed by Yiyu He
parent 66c1593c20
commit ef5c43bcbc
2 changed files with 8 additions and 11 deletions

View File

@@ -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);
},
/**

View File

@@ -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);
},
/**