MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / fakeRequire

Function fakeRequire

src/run_tests.mjs:229–241  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

227}
228
229function fakeRequire(str) {
230 if (str == "./garble") return function(string) {
231 return string.split("").map(function(ch) {
232 return String.fromCharCode(ch.charCodeAt(0) + 5)
233 }).join("")
234 }
235 if (str == "./router") return require("../code/skillsharing/router")
236 if (str == "serve-static") return Math.min
237 if (str == "fs") return fakeFS
238 if (str == "http") return fakeHTTP
239
240 return require(str)
241}
242
243let i = 0, boxes = Object.keys(sandboxes).map(k => sandboxes[k])
244function nextSandbox() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected