MCPcopy Create free account
hub / github.com/ElemeFE/element-react / getPropertyFromData

Function getPropertyFromData

src/tree/model/node.js:28–40  ·  view source on GitHub ↗
(node, prop)

Source from the content-addressed store, hash-verified

26};
27
28const getPropertyFromData = function(node, prop) {
29 const props = node.store.props;
30 const data = node.data || {};
31 const config = props[prop];
32
33 if (typeof config === 'function') {
34 return config(data, node);
35 } else if (typeof config === 'string') {
36 return data[config];
37 } else if (typeof config === 'undefined') {
38 return '';
39 }
40};
41
42let nodeIdSeed = 0;
43

Callers 4

constructorMethod · 0.85
setDataMethod · 0.85
labelMethod · 0.85
iconMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected