src/helpers/index.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 24
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 24
rs 10
wmc 4
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.js ➔ ??? 0 5 1
1
'use strict'
2
3
import moment from 'moment'
4
export { genToken } from './tokenizer'
0 ignored issues
show
Bug introduced by
The variable genToken seems to be never declared. If this is a global, consider adding a /** global: genToken */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
5
export { isFunction, isObject } from 'lodash'
0 ignored issues
show
Bug introduced by
The variable isObject seems to be never declared. If this is a global, consider adding a /** global: isObject */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable isFunction seems to be never declared. If this is a global, consider adding a /** global: isFunction */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
6
7
export const addDays = (offset, date) => {
8
  date = date || new Date()
9
  const momentAt = moment(date).add(offset, 'days')
10
  return momentAt.toDate()
11
}
12
13
export const isAfter = (first, second) => {
14
  const firstMoment = moment(first)
15
  const secondMoment = moment(second)
16
  return secondMoment.isAfter(firstMoment)
17
}
18
19
export const parseError = (error) => {
20
  if (error.expected === 'object') {
21
    const e = error.message
22
    error.message = e.slice(0, e.indexOf('(object)')).trim()
23
  }
24
}
25