MCPcopy Create free account
hub / github.com/Lobos/react-ui / formatData

Method formatData

src/RadioGroup.js:42–64  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

40 }
41
42 formatData (data) {
43 data = toTextValue(data, this.props.textTpl, this.props.valueTpl);
44 Children.map(this.props.children, (child) => {
45 if (typeof child === 'object') {
46 let position = child.props.position;
47 if (position === undefined) {
48 position = data.length;
49 }
50 data = [
51 ...data.slice(0, position),
52 {
53 $value: child.props.value,
54 $text: child.props.children || child.props.text,
55 $key: hashcode(`${child.props.value}-${child.props.text}`)
56 },
57 ...data.slice(position)
58 ];
59
60 }
61 });
62 return data;
63
64 }
65
66 setValue (value) {
67 value = transformValue(value);

Callers 6

constructorMethod · 0.95
constructorFunction · 0.45
componentWillMountFunction · 0.45

Calls 2

toTextValueFunction · 0.90
hashcodeFunction · 0.90

Tested by

no test coverage detected