mirror of
https://github.com/nolanlawson/pinafore
synced 2025-01-08 09:12:42 +01:00
12 lines
158 B
JavaScript
12 lines
158 B
JavaScript
export function thunk (fn) {
|
|
let value
|
|
let called
|
|
return () => {
|
|
if (!called) {
|
|
value = fn()
|
|
called = true
|
|
}
|
|
return value
|
|
}
|
|
}
|