MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / constructor

Method constructor

src/client/sandbox.mjs:439–443  ·  view source on GitHub ↗
(mapping)

Source from the content-addressed store, hash-verified

437
438class Cached {
439 constructor(mapping) {
440 this.mapping = mapping
441 this.work = Object.create(null)
442 this.done = Object.create(null)
443 }
444
445 compute(value) {
446 return this.work[value] || (this.work[value] = this.mapping(value).then(result => this.done[value] = result))

Callers

nothing calls this directly

Calls 1

createMethod · 0.80

Tested by

no test coverage detected