examples/unidirectional/backbone/observ-backbone.js
function serialize(model) {
    var data = model.toJSON();
    Object.keys(data).forEach(function serializeRecur(key) {
        var value = data[key];
        // if any value can be serialized toJSON() then do it
        if (value && value.toJSON) {
            data[key] = data[key].toJSON();
        }
    });
    return data;
}
function serialize(model) {
    var data = model.toJSON();
    Object.keys(data).forEach(function serializeRecur(key) {
        var value = data[key];
        // if any value can be serialized toJSON() then do it
        if (value && value.toJSON) {
            data[key] = data[key].toJSON();
        }
    });
    return data;
}
function serialize ( model ) { var data = model . toJSON ( ) ; Object . keys ( data ) . forEach ( function serializeRecur ( key ) { var value = data [ key ] ; // if any value can be serialized toJSON() then do it if ( value && value . toJSON ) { data [ key ] = data [ key ] . toJSON ( ) ; } } ) ; return data ; }
convert a Backbone model to JSON
convert a Backbone model to JSON