Passing an object to a lambda?

In the docs for Lambda it says you can pass a single argument or an array of arguments. Can you pass a single object as an argument? The reason being that if you are passing a lot of data to a lambda, getting the right order in an array is prone to error, but object passing is much easier.

Here is an example:

export default CreateFunction({
  name: "create_account",
  body: Query(
        domain: Select(["email"], Var("args")),
        name: Select(["name"], Var("args")),
  role: Role("functionrole_create_account"),


> Map([{name: 'a'}, {name: 'b'}, {name: 'c'}], Lambda("x", Var('x')))
[ { name: 'a' }, { name: 'b' }, { name: 'c' } ]
> Map([{name: 'a'}, {name: 'b'}, {name: 'c'}], Lambda("x", Select('name', Var('x'))))
[ 'a', 'b', 'c' ]

I’ve made a note to update the Lambda coverage to include an example that passes an object.

1 Like