Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /@babel /helper-validator-option /lib /validator.js
Download frontend/node_modules/@babel/helper-validator-option/lib/validator.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40babel/helper-validator-option/lib/validator.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/@babel/helper-validator-option/lib/validator.js
-
curl -L -o validator.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40babel/helper-validator-option/lib/validator.js
1.43 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { | |
| value: true | |
| }); | |
| exports.OptionValidator = void 0; | |
| var _findSuggestion = require("./find-suggestion.js"); | |
| class OptionValidator { | |
| constructor(descriptor) { | |
| this.descriptor = descriptor; | |
| } | |
| validateTopLevelOptions(options, TopLevelOptionShape) { | |
| const validOptionNames = Object.keys(TopLevelOptionShape); | |
| for (const option of Object.keys(options)) { | |
| if (!validOptionNames.includes(option)) { | |
| throw new Error(this.formatMessage(`'${option}' is not a valid top-level option. | |
| - Did you mean '${(0, _findSuggestion.findSuggestion)(option, validOptionNames)}'?`)); | |
| } | |
| } | |
| } | |
| validateBooleanOption(name, value, defaultValue) { | |
| if (value === undefined) { | |
| return defaultValue; | |
| } else { | |
| this.invariant(typeof value === "boolean", `'${name}' option must be a boolean.`); | |
| } | |
| return value; | |
| } | |
| validateStringOption(name, value, defaultValue) { | |
| if (value === undefined) { | |
| return defaultValue; | |
| } else { | |
| this.invariant(typeof value === "string", `'${name}' option must be a string.`); | |
| } | |
| return value; | |
| } | |
| invariant(condition, message) { | |
| if (!condition) { | |
| throw new Error(this.formatMessage(message)); | |
| } | |
| } | |
| formatMessage(message) { | |
| return `${this.descriptor}: ${message}`; | |
| } | |
| } | |
| exports.OptionValidator = OptionValidator; | |
| //# sourceMappingURL=validator.js.map | |