MCPcopy Index your code
hub / github.com/Effect-TS/effect / make

Function make

packages/platform/src/internal/keyValueStore.ts:31–68  ·  view source on GitHub ↗
(impl)

Source from the content-addressed store, hash-verified

29 >
30 & Partial<KeyValueStore.KeyValueStore>
31) => KeyValueStore.KeyValueStore = (impl) =>
32 keyValueStoreTag.of({
33 [TypeId]: TypeId,
34 has: (key) => Effect.map(impl.get(key), Option.isSome),
35 isEmpty: Effect.map(impl.size, (size) => size === 0),
36 modify: (key, f) =>
37 Effect.flatMap(
38 impl.get(key),
39 (o) => {
40 if (Option.isNone(o)) {
41 return Effect.succeedNone
42 }
43 const newValue = f(o.value)
44 return Effect.as(
45 impl.set(key, newValue),
46 Option.some(newValue)
47 )
48 }
49 ),
50 modifyUint8Array: (key, f) =>
51 Effect.flatMap(
52 impl.getUint8Array(key),
53 (o) => {
54 if (Option.isNone(o)) {
55 return Effect.succeedNone
56 }
57 const newValue = f(o.value)
58 return Effect.as(
59 impl.set(key, newValue),
60 Option.some(newValue)
61 )
62 }
63 ),
64 forSchema(schema) {
65 return makeSchemaStore(this, schema)
66 },
67 ...impl
68 })
69
70/** @internal */
71export const makeStringOnly: (

Callers 3

makeStringOnlyFunction · 0.70
keyValueStore.tsFile · 0.70
layerFileSystemFunction · 0.70

Calls 5

ofMethod · 0.65
mapMethod · 0.65
getMethod · 0.65
setMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected