| Conditions | 6 |
| Paths | 4 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 6 | export function add(json, type, date = null) { |
||
| 7 | let meta = config.meta.name |
||
| 8 | var currentDate = (date != null && date !== '') ? date : new Date() |
||
| 9 | var abeUrl = (type === 'publish') ? json[meta].link : cmsData.fileAttr.add(json[meta].link, 'd' + cmsData.revision.removeStatusAndDateFromFileName(currentDate.toISOString())) + '' |
||
| 10 | |||
| 11 | if(json[meta].date == null) { |
||
| 12 | json[meta].date = currentDate |
||
| 13 | } |
||
| 14 | json[meta].latest = { |
||
| 15 | date: currentDate, |
||
| 16 | abeUrl: abeUrl |
||
| 17 | } |
||
| 18 | json[meta].status = type |
||
| 19 | if(json[meta][type] == null) { |
||
| 20 | json[meta][type] = {latest: {}} |
||
| 21 | json[meta][type].date = currentDate |
||
| 22 | json[meta][type].abeUrl = abeUrl |
||
| 23 | } |
||
| 24 | // json[meta][type].latest = JSON.parse(JSON.stringify(obj)) |
||
| 25 | json[meta][type].latest.date = currentDate |
||
| 26 | json[meta][type].latest.abeUrl = abeUrl |
||
| 27 | } |
||
| 28 | |||
| 41 |