bolt
bolt copied to clipboard
Does not generate .val() if inside beginsWith
My bolt file:
path /test is Test {}
type Test {
validate() { this.beginsWith(this) }
}
output json:
{
"rules": {
"test": {
".validate": "newData.val().beginsWith(newData)"
}
}
}
Work around:
this.beginsWith(this + '')
FYI this seems to be an issue with other functions as well. Fortunately the workaround provided by @mckoss circumvents this issue.
Input bolt:
path /foo/{bar} {
write() {
this.bar[getBar(bar).bar] != null
}
}
getBar(bar) {
return prior(root).bars[bar]
}
output json:
{
"rules": {
"foo": {
"$bar": {
".write": "newData.child('bar').child(root.child('bars').child($bar).child('bar')).val() != null"
}
}
}
}