Prism · Objects

$length

How many elements a list has, or how many characters a string has.

The source
{
  tags: ['math', 'engine', 'notes'],
  name: 'Ada Lovelace',
}
The config
{
  tags: { $length: { $ref: '$.tags' } },
  name: { $length: { $ref: '$.name' } },
}
What comes out
{ tags: 3, name: 12 }
Output matches the expected value

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