File index.js
has 311 lines of code (exceeds 250 allowed). Consider refactoring.
* Created by jiachenpan on 16/11/18.
*/
export function parseTime (time, cFormat) {
Function getDateByDaysInYear
has 69 lines of code (exceeds 25 allowed). Consider refactoring.
export function getDateByDaysInYear (daysInYear, year) {
var month = 0
var day = 0
const FEB = isLeapYear(year) ? 29 : 28
const monthArray = [
Function deepClone
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
export function deepClone (source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'shallowClone')
}
const targetObj = source.constructor === Array ? [] : {}
Function getDateByDaysInYear
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
export function getDateByDaysInYear (daysInYear, year) {
var month = 0
var day = 0
const FEB = isLeapYear(year) ? 29 : 28
const monthArray = [
Function parseTime
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
export function parseTime (time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
Function debounce
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
export function debounce (func, wait, immediate) {
let timeout, args, context, timestamp, result
const later = function () {
Function parseTime
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
export function parseTime (time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
Function objectMerge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
export function objectMerge (target, source) {
giving the last one precedence */
if (typeof target !== 'object') {
Avoid too many return
statements within this function.
return parseTime(time, option)
Avoid too many return
statements within this function.
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
Function formatTime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
export function formatTime (time, option) {
time = +time * 1000
const d = new Date(time)
const now = Date.now()
Similar blocks of code found in 3 locations. Consider refactoring.
}, {
text: '最近一个月',
onClick (picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
Similar blocks of code found in 3 locations. Consider refactoring.
}, {
text: '最近一周',
onClick (picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
Similar blocks of code found in 3 locations. Consider refactoring.
}, {
text: '最近三个月',
onClick (picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
There are no issues that match your filters.