Skip to content

Instantly share code, notes, and snippets.

@msarsha
Created January 22, 2020 09:57
Show Gist options
  • Save msarsha/a3bebd35cf509d12db8850f1cf2ac3a3 to your computer and use it in GitHub Desktop.
Save msarsha/a3bebd35cf509d12db8850f1cf2ac3a3 to your computer and use it in GitHub Desktop.
tree
// --------
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