dist/jsonapi.js
function getMatchingRecord(relationship, included, parents) {
        var circular, match;

        circular = findWhere(
            parents,
            {
                id: relationship.id,
                type: relationship.type
            }
        );

        if (circular) {
            return relationship;
        }

        var key = relationship.type + '-' + relationship.id;
        match = included[key];

        // IF: No match or match is the same as parent, return the relationship information
        if (!match) {
            return relationship;
        }

        populateRelatedFields(match, included, parents);

        // IF: relationship defined meta, merge with record provided meta
        var contextSpecificMeta = {};
        if (relationship && isObject(relationship.meta)) {
            contextSpecificMeta = extend({}, match.meta, relationship.meta);
        }

        return flatten(match, contextSpecificMeta);
    }
function getMatchingRecord(relationship, included, parents) {
        var circular, match;

        circular = findWhere(
            parents,
            {
                id: relationship.id,
                type: relationship.type
            }
        );

        if (circular) {
            return relationship;
        }

        var key = relationship.type + '-' + relationship.id;
        match = included[key];

        // IF: No match or match is the same as parent, return the relationship information
        if (!match) {
            return relationship;
        }

        populateRelatedFields(match, included, parents);

        // IF: relationship defined meta, merge with record provided meta
        var contextSpecificMeta = {};
        if (relationship && isObject(relationship.meta)) {
            contextSpecificMeta = extend({}, match.meta, relationship.meta);
        }

        return flatten(match, contextSpecificMeta);
    }
function getMatchingRecord ( relationship , included , parents ) { var circular , match ; circular = findWhere ( parents , { id : relationship . id , type : relationship . type } ) ; if ( circular ) { return relationship ; } var key = relationship . type + '-' + relationship . id ; match = included [ key ] ; // IF: No match or match is the same as parent, return the relationship information if ( ! match ) { return relationship ; } populateRelatedFields ( match , included , parents ) ; // IF: relationship defined meta, merge with record provided meta var contextSpecificMeta = { } ; if ( relationship && isObject ( relationship . meta ) ) { contextSpecificMeta = extend ( { } , match . meta , relationship . meta ) ; } return flatten ( match , contextSpecificMeta ) ; }
Retrieves the record from the included objects that matches the provided relationship
Retrieves the record from the included objects that matches the provided relationship