Skip to content

Instantly share code, notes, and snippets.

@avwilks
Last active May 27, 2021 15:13
Show Gist options
  • Save avwilks/fa6a6a96c89a6fa535660b4112af1236 to your computer and use it in GitHub Desktop.
Save avwilks/fa6a6a96c89a6fa535660b4112af1236 to your computer and use it in GitHub Desktop.
Conditional Fields Example Document
{
"field1":{
"field1a":{
"when":"(a) => a.includes('USA')"
},
"field1b":{
"when":"(a) => a.includes('Mexico')"
},
"field1c":{
"when":"(a) => a.includes('Canada')",
"field1ca": {
"when": "(a) => a.includes('Ontario')",
"field1caa": {
"when": "(a) => a.length > 0"
}
}
}
},
"field2":{
"field2a": {
"when":"(a) => a === 'Yes'"
}
}
}
@cjohnson741
Copy link

a quick example of how I imagine node traversal working with this: https://codesandbox.io/s/staging-darkness-15r62?file=/src/App.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment