Operators

Object operators

Operators used to perform conditional operations.


$getField

Gets the value of a field in an object.

{ "$getField": { "field": "value", "input": "object" } }
expry({
  $getField: { field: "qty", input: { item: "apple", qty: 25, price: 4.5 } },
}); // 25

$mergeObjects

Merges objects into a single object.

{ "$mergeObjects": ["object", "object", "..."] }
expry({
  $mergeObjects: [
    { item: "apple", qty: 5, price: 2.5 },
    { qty: 10, price: 1.2, sale: true },
  ],
}); // { item: 'apple', qty: 10, price: 1.2, sale: true }

$setField

Sets a field in an object to a specified value.

{ "$setField": { "field": "string", "input": "object", "value": "any" } }
expry({
  $setField: { field: "item", input: { qty: 25, price: 4.5 }, value: "apple" },
}); // { item: 'apple', qty: 25, price: 4.5 }