Creates an insert operation with the provided items, position, and reference item.
insert
The items to insert.
The position to insert at.
The index or reference item to insert before or after.
An insert operation for adding values to arrays https://www.sanity.io/docs/http-patches#febxf6Fk
const prependFoo = insert(['foo'], 'before', 0)const appendFooAndBar = insert(['foo', 'bar'], 'after', someArray.length -1)const insertObjAfterXYZ = insert({name: 'foo'}, 'after', {_key: 'xyz'}]) Copy
const prependFoo = insert(['foo'], 'before', 0)const appendFooAndBar = insert(['foo', 'bar'], 'after', someArray.length -1)const insertObjAfterXYZ = insert({name: 'foo'}, 'after', {_key: 'xyz'}])
Creates an
insert
operation with the provided items, position, and reference item.