lib/modelItem.js
function serverProperties(item, model, props) {
    var result = {};
    var toRefresh = [];

    _.forEach(props || item, function(val, key) {
        if (val == null) return;
        if (val._isModelItem) {
            result[key] = val.id;
            toRefresh.push(val);
        } else if (_.isArray(val)) {
            result[key] = _.map(val, function(item) {
                if (item._isModelItem) {
                    toRefresh.push(item);
                    return item.id;
                }
                return item;
            });
        } else if (_.has(model.itemDef, key)) {
            if (_.has(model.itemDef[key], '__connection')) result[key] = val;
        } else result[key] = val;
    });

    return {
        properties: result,
        refresh: toRefresh
    };
}
function serverProperties(item, model, props) {
    var result = {};
    var toRefresh = [];

    _.forEach(props || item, function(val, key) {
        if (val == null) return;
        if (val._isModelItem) {
            result[key] = val.id;
            toRefresh.push(val);
        } else if (_.isArray(val)) {
            result[key] = _.map(val, function(item) {
                if (item._isModelItem) {
                    toRefresh.push(item);
                    return item.id;
                }
                return item;
            });
        } else if (_.has(model.itemDef, key)) {
            if (_.has(model.itemDef[key], '__connection')) result[key] = val;
        } else result[key] = val;
    });

    return {
        properties: result,
        refresh: toRefresh
    };
}
function serverProperties ( item , model , props ) { var result = { } ; var toRefresh = [ ] ; _ . forEach ( props || item , function ( val , key ) { if ( val == null ) return ; if ( val . _isModelItem ) { result [ key ] = val . id ; toRefresh . push ( val ) ; } else if ( _ . isArray ( val ) ) { result [ key ] = _ . map ( val , function ( item ) { if ( item . _isModelItem ) { toRefresh . push ( item ) ; return item . id ; } return item ; } ) ; } else if ( _ . has ( model . itemDef , key ) ) { if ( _ . has ( model . itemDef [ key ] , '__connection' ) ) result [ key ] = val ; } else result [ key ] = val ; } ) ; return { properties : result , refresh : toRefresh } ; }
Gets properties to be synced with the server

@param {object} item
@param {Model} model
@param {object?} props
@returns {object}
Gets properties to be synced with the server