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

Function untransformValue

src/transformer.ts:345–371  ·  view source on GitHub ↗
(
  json: any,
  type: TypeAnnotation,
  superJson: SuperJSON
)

Source from the content-addressed store, hash-verified

343});
344
345export const untransformValue = (
346 json: any,
347 type: TypeAnnotation,
348 superJson: SuperJSON
349) => {
350 if (isArray(type)) {
351 switch (type[0]) {
352 case 'symbol':
353 return symbolRule.untransform(json, type, superJson);
354 case 'class':
355 return classRule.untransform(json, type, superJson);
356 case 'custom':
357 return customRule.untransform(json, type, superJson);
358 case 'typed-array':
359 return typedArrayRule.untransform(json, type, superJson);
360 default:
361 throw new Error('Unknown transformation: ' + type);
362 }
363 } else {
364 const transformation = simpleRulesByAnnotation[type];
365 if (!transformation) {
366 throw new Error('Unknown transformation: ' + type);
367 }
368
369 return transformation.untransform(json as never, superJson);
370 }
371};

Callers 1

applyValueAnnotationsFunction · 0.85

Calls 1

isArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…