MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / nullMap

Function nullMap

shared/src/utility.ts:33–38  ·  view source on GitHub ↗
(t: T | null, f: (_: T) => R)

Source from the content-addressed store, hash-verified

31}
32
33export function nullMap<T, R>(t: T | null, f: (_: T) => R): R | null {
34 if (t === null) {
35 return t as null
36 }
37 return f(t)
38}
39
40// https://stackoverflow.com/a/65666402
41// If you update this function, also update `./utility.workerd.ts`!

Callers 2

getTemplateCommentsFunction · 0.90
getNoteCommentsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected