type.array.flatten
0.000001

Flattens a multi-dimensional array.

Arguments
level
The level to flatten the array input to. Defaults to 0.
Return Value
The flattened array.
something went wrong :(
Flattening an array
Setup
authorization=PROCAUTH
require "proc"

client = Proc.connect("PROCAUTH")
const Proc = require("@proc.dev/client");
const client = Proc.connect("PROCAUTH");
client.type.array.flatten.call(
  ["foo", ["bar", ["baz"]]], level: 1
)
client.type.array.append.call(
  ["foo", ["bar", ["baz"]]], {level: 1}
);
curl "https://proc.run/type/array/flatten?level=1" --silent \
--header "authorization: bearer $authorization" \
--header "content-type: application/json" \
--data '["foo", ["bar", ["baz"]]]'
 

["foo", "bar", ["baz"]]


Stuck? Want to chat about an idea? Join the community on Discord.