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

Function makeStringOnly

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

Source from the content-addressed store, hash-verified

77 & Partial<Omit<KeyValueStore.KeyValueStore, "set">>
78 & { readonly set: (key: string, value: string) => Effect.Effect<void, PlatformError.PlatformError> }
79) => KeyValueStore.KeyValueStore = (impl) => {
80 const encoder = new TextEncoder()
81 return make({
82 ...impl,
83 getUint8Array: (key) =>
84 impl.get(key).pipe(
85 Effect.map(Option.map((value) =>
86 Either.match(Encoding.decodeBase64(value), {
87 onLeft: () => encoder.encode(value),
88 onRight: identity
89 })
90 ))
91 ),
92 set: (key, value) =>
93 typeof value === "string"
94 ? impl.set(key, value)
95 : Effect.suspend(() => impl.set(key, Encoding.encodeBase64(value)))
96 })
97}
98
99/** @internal */
100export const prefix = dual<

Callers 1

layerStorageFunction · 0.85

Calls 6

encodeMethod · 0.80
makeFunction · 0.70
pipeMethod · 0.65
getMethod · 0.65
mapMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…