From 5109471f3bba2d4559f5a4625e47faca8b986b95 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Sun, 10 Feb 2019 23:03:20 +0530 Subject: [PATCH] fix: Remove unnecessary variadic arguments --- src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index bfea9ab..9a3291c 100644 --- a/src/index.js +++ b/src/index.js @@ -137,12 +137,12 @@ export default class PropTypes { return prop } - static arrayOf(...expected) { - return this.collectionOf(Array, expected) + static arrayOf() { + return this.collectionOf(Array, Array.from(arguments)) } - static objectOf(...expected) { - return this.collectionOf(Object, expected) + static objectOf() { + return this.collectionOf(Object, Array.from(arguments)) } /** @private */ @@ -151,7 +151,7 @@ export default class PropTypes { const types = flat(expected).map(normalizeType) prop.validator = value => - Object.values(value).every(item => + (type === Array ? value : Object.values(value)).every(item => types.some(type => runValidation(type, item)) )