MCPcopy
hub / github.com/flightcontrolhq/superjson / validatePath

Function validatePath

src/accessDeep.ts:15–25  ·  view source on GitHub ↗
(path: (string | number)[])

Source from the content-addressed store, hash-verified

13};
14
15function validatePath(path: (string | number)[]) {
16 if (includes(path, '__proto__')) {
17 throw new Error('__proto__ is not allowed as a property');
18 }
19 if (includes(path, 'prototype')) {
20 throw new Error('prototype is not allowed as a property');
21 }
22 if (includes(path, 'constructor')) {
23 throw new Error('constructor is not allowed as a property');
24 }
25}
26
27export const getDeep = (object: object, path: (string | number)[]): object => {
28 validatePath(path);

Callers 2

getDeepFunction · 0.85
setDeepFunction · 0.85

Calls 1

includesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…