MCPcopy Create free account
hub / github.com/YousefED/SyncedStore / wrapItems

Function wrapItems

packages/core/src/array.ts:37–49  ·  view source on GitHub ↗
(items)

Source from the content-addressed store, hash-verified

35 } as T[]["slice"];
36
37 const wrapItems = function wrapItems(items) {
38 return items.map((item) => {
39 const wrapped = crdtValue(item as any); // TODO
40 let valueToSet = getYjsValue(wrapped) || wrapped;
41 if (valueToSet instanceof Box) {
42 valueToSet = valueToSet.value;
43 }
44 if (valueToSet instanceof Y.AbstractType && valueToSet.parent) {
45 throw new Error("Not supported: reassigning object that already occurs in the tree.");
46 }
47 return valueToSet;
48 });
49 };
50
51 const findIndex = function findIndex() {
52 return [].findIndex.apply(slice.apply(this), arguments);

Callers 1

arrayImplementationFunction · 0.85

Calls 2

crdtValueFunction · 0.90
getYjsValueFunction · 0.85

Tested by

no test coverage detected