Download node_modules/fast-check/lib/utils/apply.js from Really-amin/Datasourceforcryptocurrency: direct link, hf CLI and curl.
- Browser
- Download file 697 Bytes
-
https://huggingface.co/spaces/Really-amin/Datasourceforcryptocurrency/resolve/250b128700538234afd94de5d02f4e054f24823e/node_modules/fast-check/lib/utils/apply.js
- Command line
-
hf download hf://spaces/Really-amin/Datasourceforcryptocurrency@250b128700538234afd94de5d02f4e054f24823e/node_modules/fast-check/lib/utils/apply.js
-
curl -L -o apply.js https://huggingface.co/spaces/Really-amin/Datasourceforcryptocurrency/resolve/250b128700538234afd94de5d02f4e054f24823e/node_modules/fast-check/lib/utils/apply.js
697 Bytes
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.safeApply = safeApply; | |
| const untouchedApply = Function.prototype.apply; | |
| const ApplySymbol = Symbol('apply'); | |
| function safeExtractApply(f) { | |
| try { | |
| return f.apply; | |
| } | |
| catch (err) { | |
| return undefined; | |
| } | |
| } | |
| function safeApplyHacky(f, instance, args) { | |
| const ff = f; | |
| ff[ApplySymbol] = untouchedApply; | |
| const out = ff[ApplySymbol](instance, args); | |
| delete ff[ApplySymbol]; | |
| return out; | |
| } | |
| function safeApply(f, instance, args) { | |
| if (safeExtractApply(f) === untouchedApply) { | |
| return f.apply(instance, args); | |
| } | |
| return safeApplyHacky(f, instance, args); | |
| } | |