Completed
Push — master ( 652c21...99e276 )
by greg
10:52 queued 08:59
created

abe-date.js ➔ dateSlug   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
cc 1
rs 10
1
import clc from 'cli-color'
2
3
export function dateSlug(date) {
4
  return date.replace(/[-:\.]/g, '')
5
}
6
7
export function dateUnslug(date, file) {
8
  if (date.indexOf(':') > -1 || date.indexOf('-') > -1 || date.indexOf('.') > -1) {
9
    console.log(clc.green('[ WARNING ] you have old file architecture'), file)
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
10
    return date
11
  }
12
  var res = date.substring(0, 4) + '-'
13
            + date.substring(4, 6) + '-'
14
            + date.substring(6, 11) + ':'
15
            + date.substring(11, 13) + ':'
16
            + date.substring(13, 15) + '.'
17
            + date.substring(15, 19)
18
  return res
19
}