MCPcopy Index your code
hub / github.com/Packstack-Tech/packstack / sanitizeRequest

Function sanitizeRequest

api/utils/build-payload.js:3–12  ·  view source on GitHub ↗
(request, attributes)

Source from the content-addressed store, hash-verified

1import models from '../models';
2
3const sanitizeRequest = (request, attributes) => {
4 const { id, ...payload } = request;
5 Object.keys(payload).forEach(key => {
6 if (!attributes.includes(key)) {
7 delete payload[key]
8 }
9 });
10
11 return { id, payload };
12};
13
14export const itemPayload = (request) => {
15 const itemAttrs = Object.keys(models.Item.rawAttributes);

Callers 3

itemPayloadFunction · 0.85
packPayloadFunction · 0.85
packItemPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected