Created
January 22, 2020 09:58
-
-
Save msarsha/2d8d7724654c68bb9cf99e1bcccb112b to your computer and use it in GitHub Desktop.
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