Completed
Push — master ( 39b560...f48291 )
by greg
01:42
created

file.js ➔ changePath   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 6
rs 9.4285
nop 2
1
import fse from 'fs-extra'
2
import path from 'path'
3
4
import {
5
  config
6
} from '../../'
7
8
export function exist(pathFile) {
9
  try{
10
    fse.statSync(pathFile)
11
    return true
12
  }catch(e){
13
    return false
14
  }
15
16
  return false
0 ignored issues
show
introduced by
This code is unreachable and can thus be removed without consequences.
Loading history...
17
}
18
19
export function changePath(pathEnv, change) {
20
  pathEnv = pathEnv.replace(config.root, '').replace(/^\//, '').split('/')
21
  pathEnv[0] = change
22
23
  return path.join(config.root, pathEnv.join('/'))
24
}
25