From 64204434666ec1560f9dc0a5233599af28f0e5b5 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Wed, 1 Jul 2020 18:24:38 +0800 Subject: [PATCH] style: format code --- components/date-picker/utils.js | 6 +----- components/table/Table.jsx | 2 +- components/vc-calendar/src/util/index.js | 6 +----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/components/date-picker/utils.js b/components/date-picker/utils.js index b2044c313..184739ac6 100644 --- a/components/date-picker/utils.js +++ b/components/date-picker/utils.js @@ -1,15 +1,11 @@ export function formatDate(value, format) { - const isFunction = function(obj) { - return !!(obj && obj.constructor && obj.call && obj.apply); - }; - if (!value) { return ''; } if (Array.isArray(format)) { format = format[0]; } - if (isFunction(format)) { + if (typeof format === 'function') { const result = format(value); if (typeof result === 'string') { return result; diff --git a/components/table/Table.jsx b/components/table/Table.jsx index 423c07a0b..25798171d 100755 --- a/components/table/Table.jsx +++ b/components/table/Table.jsx @@ -157,7 +157,7 @@ export default { sPagination: this.getDefaultPagination(this.$props), pivot: undefined, sComponents: createComponents(this.components), - filterDataCnt: 0 + filterDataCnt: 0, }; }, watch: { diff --git a/components/vc-calendar/src/util/index.js b/components/vc-calendar/src/util/index.js index cd7e4d179..296e046cb 100644 --- a/components/vc-calendar/src/util/index.js +++ b/components/vc-calendar/src/util/index.js @@ -92,10 +92,6 @@ export function isAllowedDate(value, disabledDate, disabledTime) { } export function formatDate(value, format) { - const isFunction = function(obj) { - return !!(obj && obj.constructor && obj.call && obj.apply); - }; - if (!value) { return ''; } @@ -104,7 +100,7 @@ export function formatDate(value, format) { format = format[0]; } - if (isFunction(format)) { + if (typeof format === 'function') { const result = format(value); if (typeof result === 'string') { return result;