core.unless0.000001
Calls a composition for falsey input.
Arguments
procrequired
The composition to execute for falsey inputs.Return Value
The result of the given composition, or null if the input is truthy.something went wrong :(
Conditionally echoing a value
Setup
authorization=PROCAUTH
require "proc"
client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.core.unless {
client.core.echo("is false")
}.call(false)
client.core.unless(undefined, {}, () => {
return client.core.echo("is false");
}).call(false);
curl "https://proc.run/core/unless" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/vnd.proc+json" \
--header "accept: text/plain" \
--data '[[">>", ["%%", false]], ["$$", "proc", ["{}", ["()", "core.echo", [">>", ["%%", "is false"]]]]]]'
is false
Note that core.unless
cannot be composed with core.else
.
Stuck? Want to chat about an idea? Join the community on Discord.