MCPcopy Index your code
hub / github.com/parse-community/parse-server / parseObject

Function parseObject

src/Routers/FunctionsRouter.js:32–58  ·  view source on GitHub ↗
(obj, config)

Source from the content-addressed store, hash-verified

30}
31
32function parseObject(obj, config) {
33 if (Array.isArray(obj)) {
34 return obj.map(item => {
35 return parseObject(item, config);
36 });
37 } else if (obj && obj.__type == 'Date') {
38 return Object.assign(new Date(obj.iso), obj);
39 } else if (obj && obj.__type == 'File') {
40 if (obj.url) {
41 const { validateFileUrl } = require('../FileUrlValidator');
42 validateFileUrl(obj.url, config);
43 }
44 return Parse.File.fromJSON(obj);
45 } else if (obj && obj.__type == 'Pointer') {
46 return Parse.Object.fromJSON({
47 __type: 'Pointer',
48 className: obj.className,
49 objectId: obj.objectId,
50 });
51 } else if (Buffer.isBuffer(obj)) {
52 return obj;
53 } else if (obj && typeof obj === 'object') {
54 return parseParams(obj, config);
55 } else {
56 return obj;
57 }
58}
59
60function parseParams(params, config) {
61 return _.mapValues(params, item => parseObject(item, config));

Callers 1

parseParamsFunction · 0.85

Calls 2

validateFileUrlFunction · 0.85
parseParamsFunction · 0.85

Tested by

no test coverage detected