Skip to content

Instantly share code, notes, and snippets.

const postObj = {};
function parseTree(root) {
for (const child in root) {
const choice = values[child];
if (!isEmpty(choice.value)) {
// push the value in post object
postObj[choice.name] = choice.value;
}
if (root[child]) {
// call parse tree with the child
const decisionTree = {
DRINKS: {
ALCOHOLIC: {
PREFREENCES: {
WINE: {
DRINK_NAME: NULL,
},
BEER: {
DRINK_NAME: NULL,
}
function basicField(Field, key) {
class BasicField extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(value, error) {
// run validations
const { validations } = this.props.field;
const errors = [error].filter(v => v);
{
"fieldKey": {
"name": "billingCycle",
"displayName": "Billing Cycle",
"validations": ["REQUIRED", "AMOUNT"]
}
}