A String expression of the Promise chain.
Mapping promise methods to a string expression.
Pipeline would always pass the result to the down stream.
- .then()
- .catch()
- .all()
- .race()
- .finally()
- .allSettled()
>
.then#
.catch&&
.all||
.race()
punctuation
The following table lists the precedence symbols. symbols are listed top to bottom, in descending precedence.
Precedence | Symbol | Description |
---|---|---|
1 | () |
group the Promise chain |
2 | > # |
Promise then and catch |
3 | && || |
Promise All and Race |
functions: foo
, bar
, boo
, far
Example 1: foo > bar > boo > far
would convert to Javascript
foo()
.then(bar)
.then(boo)
.then(far)
Example 2: foo > bar # boo > far
would convert to Javascript
foo()
.then(bar)
.catch(boo)
.then(far)
Example 3: foo && bar > boo > far
would convert to Javascript
Promise.all([
foo(),
bar()
.then(boo)
.then(far)
])
Example 4: (foo && bar) > boo > far
would convet to Javascript
Promise.all([
foo(),
bar()
])
.then(boo)
.then(far)
Example 5: (foo || bar) > boo # far
would convert to Javascript
Promise.race([
foo(),
bar()
])
.then(boo)
.catch(far)
Example 6: (foo > bar) && boo # far
would convert to Javascript
Promise.all([
foo()
.then(bar),
boo()
])
.catch(far)
So symbols precedence looks like (high -> low):
()
>
,#
&&
,||