experimental.objectKeys() function

The experimental.objectKeys() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.objectKeys() function returns an array of keys in a specified record.

*Function type: Transformation*

  1. import "experimental"
  2. experimental.objectKeys(
  3. o: {key1: "value1", key2: "value2"}
  4. )
  5. // Returns [key1, key2]

Parameters

o

The record to return keys from.

*Data type: Record*

Examples

Return all keys in a record

  1. import "experimental"
  2. user = {
  3. firstName: "John",
  4. lastName: "Doe",
  5. age: 42
  6. }
  7. experimental.objectKeys(o: user)
  8. // Returns [firstName, lastName, age]