MCPcopy
hub / github.com/YousefED/SyncedStore / propertyToNumber

Function propertyToNumber

packages/core/src/array.ts:151–160  ·  view source on GitHub ↗
(p: string | number | symbol)

Source from the content-addressed store, hash-verified

149}
150
151function propertyToNumber(p: string | number | symbol) {
152 if (typeof p === "string" && p.trim().length) {
153 const asNum = Number(p);
154 // https://stackoverflow.com/questions/10834796/validate-that-a-string-is-a-positive-integer
155 if (Number.isInteger(asNum)) {
156 return asNum;
157 }
158 }
159 return p;
160}
161
162export function crdtArray<T>(initializer: T[], arr = new Y.Array<T>()) {
163 if (arr[$reactive]) {

Callers 2

crdtArrayFunction · 0.85
getOwnPropertyDescriptorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected