Skip to content

Commit ef5c43b

Browse files
tinovyatkindead-horse
authored andcommitted
chore: use rest params (#1393)
1 parent 66c1593 commit ef5c43b

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lib/request.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -622,15 +622,14 @@ module.exports = {
622622
*
623623
* this.is('html'); // => false
624624
*
625-
* @param {String|Array} types...
625+
* @param {String|String[]} [type]
626+
* @param {String[]} [types]
626627
* @return {String|false|null}
627628
* @api public
628629
*/
629630

630-
is(types) {
631-
if (!types) return typeis(this.req);
632-
if (!Array.isArray(types)) types = [].slice.call(arguments);
633-
return typeis(this.req, types);
631+
is(type, ...types) {
632+
return typeis(this.req, type, ...types);
634633
},
635634

636635
/**

lib/response.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,14 @@ module.exports = {
389389
* Check whether the response is one of the listed types.
390390
* Pretty much the same as `this.request.is()`.
391391
*
392-
* @param {String|Array} types...
392+
* @param {String|String[]} [type]
393+
* @param {String[]} [types]
393394
* @return {String|false}
394395
* @api public
395396
*/
396397

397-
is(types) {
398-
const type = this.type;
399-
if (!types) return type || false;
400-
if (!Array.isArray(types)) types = [].slice.call(arguments);
401-
return typeis(type, types);
398+
is(type, ...types) {
399+
return typeis(this.type, type, ...types);
402400
},
403401

404402
/**

0 commit comments

Comments
 (0)