Prism · Objects

$omit

Drops the named keys of an object and keeps the rest.

The source
{
  user: {
    id: 'u_42',
    name: 'Ada Lovelace',
    email: '[email protected]',
    passwordHash: 'sekret-do-not-share',
    sessionToken: 'also-sekret',
    createdAt: '2024-01-01',
  },
}
The config
{
  $omit: {
    from: { $ref: '$.user' },
    keys: ['passwordHash', 'sessionToken'],
  },
}
What comes out
{
  id: 'u_42',
  name: 'Ada Lovelace',
  email: '[email protected]',
  createdAt: '2024-01-01',
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.