Curly braces are used for 2 completely different purposes. When they do NOT contain a pipe symbol ('|'), they represent literal JavaScript code. When used like this, the curly braces typically appear on different lines. For example:
.logout( options )
options := {
page: page
, success: success-function
}
When a pair of curly braces DOES contain one or more pipe symbols, a list of alternatives is presented from which you must choose exactly one. When used like this, the curly braces typically appear on the same line. The syntax prescription:
.checkRecords( options )
options := {
double: double
}
double := { all | current }
is matched by exactly 1 of the following 2 realizations (assuming that the values for double are strings, and therefore must be surrounded by single quotes):
.checkRecords( { double: 'all' } )
.checkRecords( { double: 'current' } )
In curly braces with one or more pipe symbols, it is possible for exactly one of the values to be underlined. This means that the underlined value is the default value. It implies that the item that has the value is in fact optional, and that cases where it does not appear are equivalent to cases where it appears with the default value. Thus, given the prescription:
.checkRecords( options )
options := {
double: double
}
double := { all | current }
the following 2 code snippets are equivalent matches:
.checkRecords()
.checkRecords( { double: 'all' } )
If the ending brace is immediately preceded by a pipe symbol, then other values besides the enumerated values are also allowed:
{ next | previous | }
The following means that the value 'edit' applies if you do not specify the item at all. If you do specify the item, it may have any value:
{ edit | }
|