MCPcopy
hub / github.com/Effect-TS/effect / valueToOption

Function valueToOption

packages/experimental/src/Persistence/Lmdb.ts:32–40  ·  view source on GitHub ↗
(key: string, _: any)

Source from the content-addressed store, hash-verified

30 (store) => Effect.promise(() => store.close())
31 )
32 const valueToOption = (key: string, _: any) => {
33 if (!Arr.isArray(_)) return Option.none()
34 const [value, expires] = _ as [unknown, number | null]
35 if (expires !== null && expires <= clock.unsafeCurrentTimeMillis()) {
36 store.remove(key)
37 return Option.none()
38 }
39 return Option.some(value)
40 }
41 return identity<Persistence.BackingPersistenceStore>({
42 get: (key) =>
43 Effect.try({

Callers 1

makeFunction · 0.85

Calls 2

removeMethod · 0.65

Tested by

no test coverage detected