UNPKG

kitsu-core

Version:

Simple, lightweight & framework agnostic JSON:API (de)serialsation components

25 lines (22 loc) 411 B
import { error } from './error.mjs'; function filterIncludes(included, { id, type }) { try { if (id && type) { const filtered = included.filter(el => { return el.id === id && el.type === type; })[0] || { id, type }; return Object.assign({}, filtered); } else { return {}; } } catch (E) { error(E); } } export { filterIncludes };