Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's wrong with:

    return {
        labels: data.items.map(function(value){
            return {
                type: "label",
                value: value > 10 ? value : value * 100
            };
        })
    };
I hope your project does not get too popular.


Even cleaner with ES6.

return { labels: data.items.map(value => { type: "label", value: value > 10 ? value : value * 100 }) };




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: