MCPcopy
hub / github.com/alibaba/x-render / transDataKeyToData

Function transDataKeyToData

packages/data-render/src/utils/common.ts:295–313  ·  view source on GitHub ↗
(object: any, { data, addons }: any)

Source from the content-addressed store, hash-verified

293};
294
295export const transDataKeyToData = (object: any, { data, addons }: any) => {
296 // 进行动态数据绑定
297 Object.keys(object).forEach((key) => {
298 const item = object[key];
299 if (typeof item !== 'string') {
300 return;
301 }
302
303 if (startsWith(item, 'source:')) {
304 object[key] = getValueFromKey({ path: item, data, addons });
305 return;
306 }
307
308 if (startsWith(item, 'data:')) {
309 const path = item.split('data:')[1]?.trim();
310 object[key] = getValueFromKey({ path, data, addons });
311 }
312 });
313};

Callers

nothing calls this directly

Calls 2

startsWithFunction · 0.70
getValueFromKeyFunction · 0.70

Tested by

no test coverage detected