Completed
Pull Request — master (#66)
by
unknown
02:44
created

src/cli/cms/templates/handlebars/removeRootPath.js   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 11
Function Count 1

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 11
rs 10
wmc 1
mnd 0
bc 1
fnc 1
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A removeRootPath.js ➔ removeRootPath 0 6 1
1
import Handlebars from 'handlebars'
2
3
/**
4
 * Handlebars helper, remove config.root from array of path
5
 */
6
export default function removeRootPath(obj, url, formater) {
7
  obj = JSON.parse(JSON.stringify(obj).replace(new RegExp(JSON.parse(url).root, 'g'), ''))
8
  obj = Handlebars.helpers[formater](obj)
9
	
10
  return obj
11
}
12