DWI

mail@pastecode.io avatar
unknown
javascript
3 years ago
591 B
5
Indexable
Never
xxx.map(x => {
    let newObject = Object.assign({}, x),
    slug = x.slug ? x.slug : x.name_slug,
    goal = x.goal ? x.goal : x.gt_count,
    current = x.current ? x.current : 0,
    icon = ''
    //ambil icon
    switch (slug) {
        case 'beauty-profile':
            icon = ''
            break;
        default:
            icon = ''
            break;
    }
    //currency
    if (slug === 'shopping-amount') {
        goal = curreny(goal)
        current = cuurency(goal)
    }

    return {
        ...newObject,
        slug,
        icon,
        goal,
        current
    }
})