Repository: automerge/automerge (language: rust)

Issue:
Add Array.at to document array
It would be great to get better parity with ecma script standard on arrays and add `.at` to arrays stored in a document.

Example:
```ts
const repo = new Repo()
const handle = repo.create({ items: ['item1'] })

handle.change(doc => {
  if (typeof doc.items.at(0) !== 'string') throw Error('invalid document')
})
```


Discussion / hints:

Fix patch:
diff --git a/javascript/src/proxies.ts b/javascript/src/proxies.ts
index 76470e394..1a569cc07 100644
--- a/javascript/src/proxies.ts
+++ b/javascript/src/proxies.ts
@@ -599,6 +599,10 @@ export function rootProxy<T>(context: Automerge, textV2: boolean): T {
 function listMethods<T extends Target>(target: T) {
   const { context, objectId, path, textV2 } = target
   const methods = {
+    at(index: number) {
+      return valueAt(target, index)
+    },
+
     deleteAt(index: number, numDelete: number) {
       if (typeof numDelete === "number") {
         context.splice(objectId, index, numDelete)


Test patch:
diff --git a/javascript/test/proxies.ts b/javascript/test/proxies.ts
index 3cda5ab83..006fa9cc8 100644
--- a/javascript/test/proxies.ts
+++ b/javascript/test/proxies.ts
@@ -147,6 +147,15 @@ describe("Proxies", () => {
         }, /list\/0/)
       })
     })
+
+    it("should support .at() to access values", () => {
+      const doc = from<{ list: string[] }>({ list: ["a", "b"] })
+      change(doc, d => {
+        assert.doesNotThrow(() => {
+          assert.equal(typeof d.list.at(0), "string")
+        })
+      })
+    })
   })
 
   describe("structuredClone support", () => {