Created
January 22, 2020 09:57
-
-
Save msarsha/a3bebd35cf509d12db8850f1cf2ac3a3 to your computer and use it in GitHub Desktop.
tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------- | |
const singleTree = { | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}; | |
/* | |
| | |
| ---- | |
OR | |
| ---- | |
| | |
*/ | |
const simpleTree = { | |
branches: [ | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
}; | |
/* | |
| | ---- | |
| OR | |
| | ---- | |
AND | |
| | |
| ------------ | |
*/ | |
const complexTree = { | |
branches: [ | |
{ | |
branches: [ | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
}, | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'AND' | |
}; | |
/* | |
| | ---- | |
| OR | |
| | ---- | |
AND | |
| | ---- | |
| OR | |
| | ---- | |
*/ | |
const complexTree2 = { | |
branches: [ | |
{ | |
branches: [ | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
}, | |
{ | |
branches: [ | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches:[], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
} | |
], | |
operation: 'AND' | |
}; | |
/* | |
| | | ---- | |
| | OR | |
| | | ---- | |
| AND | |
| | | ---- | |
| | OR | |
| | | ---- | |
OR | |
| | ---------- | |
| OR | |
| | ---------- | |
*/ | |
const complexTree3 = { | |
branches: [ | |
{ | |
branches: [ | |
{ | |
branches: [ | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
}, | |
{ | |
branches: [ | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
} | |
], | |
operation: 'AND' | |
}, | |
{ | |
branches: [ | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
}, | |
{ | |
branches: [], | |
operation: null, | |
value: { | |
dataSource: 'customer props', | |
fieldOrFunc: 'installation date', | |
operation: { | |
name: 'between', | |
value: ['date', 'date'] | |
} | |
} | |
} | |
], | |
operation: 'OR' | |
} | |
], | |
operation: 'OR' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment