chore: use rest params (#1393)
This commit is contained in:
committed by
Yiyu He
parent
66c1593c20
commit
ef5c43bcbc
@@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user