MCPcopy
hub / github.com/tinyplex/tinybase / ifTransformed

Function ifTransformed

src/store/index.ts:344–354  ·  view source on GitHub ↗
(
    snapshot: Value,
    getResult: () => Value | undefined,
    then: (result: Value) => Result,
    isEqual: (a: Value, b: Value) => boolean = Object.is,
  )

Source from the content-addressed store, hash-verified

342 };
343
344 const ifTransformed = <Value, Result>(
345 snapshot: Value,
346 getResult: () => Value | undefined,
347 then: (result: Value) => Result,
348 isEqual: (a: Value, b: Value) => boolean = Object.is,
349 ): Result | undefined =>
350 ifNotUndefined(getResult(), (result) =>
351 snapshot === result || isEqual(snapshot, result)
352 ? then(result)
353 : whileMutating(() => then(result)),
354 );
355
356 const validateTablesSchema = (
357 tableSchema: TablesSchema | undefined,

Callers 8

setValidContentFunction · 0.70
setValidTablesFunction · 0.70
setValidTableFunction · 0.70
setValidRowFunction · 0.70
setValidCellFunction · 0.70
setValidValuesFunction · 0.70
setValidValueFunction · 0.70
applyChangesFunction · 0.70

Calls 3

whileMutatingFunction · 0.70
getResultFunction · 0.50
isEqualFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…