MCPcopy Create free account
hub / github.com/Effect-TS/effect / loadExamples

Function loadExamples

packages/tools/doctest/src/Plugin.ts:44–60  ·  view source on GitHub ↗
(
    file: string,
    version?: string | undefined
  )

Source from the content-addressed store, hash-verified

42 }>()
43
44 const loadExamples = (
45 file: string,
46 version?: string | undefined
47 ): Promise<ReadonlyArray<Source.Snippet>> => {
48 const cached = cache.get(file)
49 if (cached !== undefined && cached.version === version) {
50 return cached.value
51 }
52
53 const loaded = Source.extractFile(file).then((snippets) => {
54 store.set(file, snippets)
55 return snippets
56 })
57
58 cache.set(file, { version, value: loaded })
59 return loaded
60 }
61
62 return {
63 name: "effect-doctest",

Callers 1

loadFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected