dist/utils.js
function flattenRecord(record) {
    var data = {
        __internal: {
            id: record.id,
            type: record.type,
        },
    };
    objectForEach(record.attributes, function (key) {
        data[key] = record.attributes[key];
    });
    objectForEach(record.relationships, function (key) {
        var rel = record.relationships[key];
        if (rel.meta) {
            data[key + "Meta"] = rel.meta;
        }
        if (rel.links) {
            data.__internal.relationships = data.__internal.relationships || {};
            data.__internal.relationships[key] = rel.links;
        }
    });
    objectForEach(record.links, function (key) {
        /* istanbul ignore else */
        if (record.links[key]) {
            data.__internal.links = data.__internal.links || {};
            data.__internal.links[key] = record.links[key];
        }
    });
    objectForEach(record.meta, function (key) {
        /* istanbul ignore else */
        if (record.meta[key] !== undefined) {
            data.__internal.meta = data.__internal.meta || {};
            data.__internal.meta[key] = record.meta[key];
        }
    });
    return data;
}
function flattenRecord(record) {
    var data = {
        __internal: {
            id: record.id,
            type: record.type,
        },
    };
    objectForEach(record.attributes, function (key) {
        data[key] = record.attributes[key];
    });
    objectForEach(record.relationships, function (key) {
        var rel = record.relationships[key];
        if (rel.meta) {
            data[key + "Meta"] = rel.meta;
        }
        if (rel.links) {
            data.__internal.relationships = data.__internal.relationships || {};
            data.__internal.relationships[key] = rel.links;
        }
    });
    objectForEach(record.links, function (key) {
        /* istanbul ignore else */
        if (record.links[key]) {
            data.__internal.links = data.__internal.links || {};
            data.__internal.links[key] = record.links[key];
        }
    });
    objectForEach(record.meta, function (key) {
        /* istanbul ignore else */
        if (record.meta[key] !== undefined) {
            data.__internal.meta = data.__internal.meta || {};
            data.__internal.meta[key] = record.meta[key];
        }
    });
    return data;
}
function flattenRecord ( record ) { var data = { __internal : { id : record . id , type : record . type , } , } ; objectForEach ( record . attributes , function ( key ) { data [ key ] = record . attributes [ key ] ; } ) ; objectForEach ( record . relationships , function ( key ) { var rel = record . relationships [ key ] ; if ( rel . meta ) { data [ key + "Meta" ] = rel . meta ; } if ( rel . links ) { data . __internal . relationships = data . __internal . relationships || { } ; data . __internal . relationships [ key ] = rel . links ; } } ) ; objectForEach ( record . links , function ( key ) { /* istanbul ignore else */ if ( record . links [ key ] ) { data . __internal . links = data . __internal . links || { } ; data . __internal . links [ key ] = record . links [ key ] ; } } ) ; objectForEach ( record . meta , function ( key ) { /* istanbul ignore else */ if ( record . meta [ key ] !== undefined ) { data . __internal . meta = data . __internal . meta || { } ; data . __internal . meta [ key ] = record . meta [ key ] ; } } ) ; return data ; }
Flatten the JSON API record so it can be inserted into the model

@export
@param {IJsonApiRecord} record - original JSON API record
@returns {IDictionary<any>} - Flattened object
Flatten the JSON API record so it can be inserted into the model