type.hash.build0.000001
Builds a new hash.
Arguments
no defined arguments
Return Value
The given input coerced to a hash, or an empty hash if no input is given.something went wrong :(
Building and using a hash
Setup
authorization=PROCAUTH
require "proc"
client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
composition = client.type.hash >> client.type.hash.set(
key: "foo", value: "bar"
)
composition.call
let composition = client.type.hash.compose(
client.type.hash.set(
undefined, {key: "foo", value: "bar"}
)
);
composition.call();
curl "https://proc.run/core/exec" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/vnd.proc+json" \
--header "accept: text/plain" \
--data '[["$$", "proc", ["{}", ["()", "type.hash"], ["()", "type.hash.set", ["$$", "key", ["%%", "foo"]], ["$$", "value", ["%%", "bar"]]]]]]'
{"foo": "bar"}
Like all value builders type.hash.build
is callable through the root type.hash
proc.
Stuck? Want to chat about an idea? Join the community on Discord.