Sanity Library Reference Docs
    Preparing search index...

    Function prepend

    • Creates an insert operation that prepends the provided items.

      Type Parameters

      • const Items extends AnyArray<unknown>

      Parameters

      • items: Items | ArrayElement<Items>

        The items to prepend.

      Returns InsertOp<NormalizeReadOnlyArray<Items>, "before", 0>

      An insert operation for adding a value to the start of an array. https://www.sanity.io/docs/http-patches#refAUsf0

      const prependFoo = prepend('foo')
      const prependObject = prepend({name: 'foo'})
      const prependObjects = prepend([{name: 'foo'}, [{name: 'bar'}]])