We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
?|>
@STRd6 suggests the ability to short-circuit the rest of a pipe when the left-hand side is null:
x ?|> f --- x != null ? f(x) : x //or x == null ? x : f(x)
The text was updated successfully, but these errors were encountered:
A possible refinement/expansion could be ?> and !> as pipe-if and pipe-unless.
?>
!>
foo := try line1() !> return bar := try line2() !> return ... vvv let ref; try(){ref = line1()}catch(e){}; if(!ref) return ref; const foo = ref;
It passes the value to the pipe depending on the condition, then returns the value if not passed or the result of the of the pipe if it was passed.
It may need some finessing but that's the general idea.
Something else to consider could be a error/non-error pipe as well. It could pass if the value extends Error.
Error
Some further questions:
👨🍳
Sorry, something went wrong.
Are non-null and falsey different enough to warrant different pipes?
There are four distinct falsy values a number? may have, but only one of them is nullish. (The other three are 0, -0, and NaN.)
number?
0
-0
NaN
guard
else
No branches or pull requests
@STRd6 suggests the ability to short-circuit the rest of a pipe when the left-hand side is null:
The text was updated successfully, but these errors were encountered: