JSFiddle - React, Tailwind, and code Playground

by nikoshr

HTML

<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>

JavaScript

var ArticlesCollection = Backbone.Collection.extend({
    parse : function(response) {
        return _.chain(response)
            .map(function(response) {
                return {
                    date: this.dateSinceFormatter(response.date)
                };
            }, this)
            .value();
    },
    dateSinceFormatter: function(dt) {
        return 'Formatted : '+dt;
    }
});

var c = new ArticlesCollection([
    {date: 'd1'},
    {date: 'd2'}
], {parse: true});
console.log(c.pluck('date'));