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

Function expand

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

Source from the content-addressed store, hash-verified

29
30 // Expand function used in GET /name and GET /name/id
31 function expand(resource, e) {
32 e &&
33 [].concat(e).forEach((innerResource) => {
34 const plural = pluralize(innerResource)
35 if (db.get(plural).value()) {
36 const prop = `${innerResource}${opts.foreignKeySuffix}`
37 resource[innerResource] = db
38 .get(plural)
39 .getById(resource[prop])
40 .value()
41 }
42 })
43 }
44
45 // GET /name
46 // GET /name?q=

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…