| Total Complexity | 5 |
| Complexity/F | 2.5 |
| Lines of Code | 23 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | |||
| 2 | export default function recursivePrintConfig(obj, key = '') { |
||
| 3 | var res = '' |
||
| 4 | |||
| 5 | if(typeof obj === 'object' && Object.prototype.toString.call(obj) === '[object Object]') { |
||
| 6 | Array.prototype.forEach.call(Object.keys(obj), (k) => { |
||
| 7 | var strKey = key |
||
| 8 | if(strKey !== '') { |
||
| 9 | strKey += '.' |
||
| 10 | } |
||
| 11 | strKey += k |
||
| 12 | res += recursivePrintConfig(obj[k], strKey) |
||
| 13 | }) |
||
| 14 | }else { |
||
| 15 | res += `<div class="form-group"> |
||
| 16 | <label class="col-sm-4 control-label" for="${key}">${key}</label> |
||
| 17 | <div class="col-sm-8"> |
||
| 18 | <input type="text" class="form-control" id="${key}" data-json-key="${key}" placeholder="${obj}" value="${obj}"> |
||
| 19 | </div> |
||
| 20 | </div>` |
||
| 21 | } |
||
| 22 | |||
| 23 | return res |
||
| 24 | } |
||
| 25 |