MCPcopy
hub / github.com/typicode/json-server / embed

Function embed

src/server/router/plural.js:15–28  ·  view source on GitHub ↗
(resource, e)

Source from the content-addressed store, hash-verified

13
14 // Embed function used in GET /name and GET /name/id
15 function embed(resource, e) {
16 e &&
17 [].concat(e).forEach((externalResource) => {
18 if (db.get(externalResource).value) {
19 const query = {}
20 const singularResource = pluralize.singular(name)
21 query[`${singularResource}${opts.foreignKeySuffix}`] = resource.id
22 resource[externalResource] = db
23 .get(externalResource)
24 .filter(query)
25 .value()
26 }
27 })
28 }
29
30 // Expand function used in GET /name and GET /name/id
31 function expand(resource, e) {

Callers 2

listFunction · 0.85
showFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…