UNPKG

@swaggerexpert/json-api-merge

Version:

JSON:API specific redundant duplication algorithm for merging included resources into original data.

31 lines (28 loc) 521 B
var jsonApiMerge = require('@swaggerexpert/json-api-merge'); var jsonApiData = { data: { id: 1, type: 'resource', attributes: { name: 'Resource name', }, relationships: { related: { data: { id: 2, type: 'related_resource', }, }, }, }, included: [ { id: 2, type: 'related_resource', attributes: { name: 'Related resource name', }, }, ], }; jsonApiMerge(jsonApiData.included, jsonApiData.data);