Innovenergy_trunk/frontend/node_modules/testcafe/lib/utils/get-options/meta.js

24 lines
3.0 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = __importDefault(require("./base"));
const types_1 = require("../../errors/types");
const runtime_1 = require("../../errors/runtime");
async function default_1(optionName, options) {
const metaOptions = await (0, base_1.default)(options, {
skipOptionValueTypeConversion: true,
async onOptionParsed(key, value) {
if (!key || !value)
throw new runtime_1.GeneralError(types_1.RUNTIME_ERRORS.optionValueIsNotValidKeyValue, optionName);
return String(value);
},
});
if (Object.keys(metaOptions).length === 0)
throw new runtime_1.GeneralError(types_1.RUNTIME_ERRORS.optionValueIsNotValidKeyValue, optionName);
return metaOptions;
}
exports.default = default_1;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy91dGlscy9nZXQtb3B0aW9ucy9tZXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsa0RBQW9DO0FBQ3BDLDhDQUFvRDtBQUNwRCxrREFBb0Q7QUFHckMsS0FBSyxvQkFBVyxVQUFrQixFQUFFLE9BQWU7SUFDOUQsTUFBTSxXQUFXLEdBQUcsTUFBTSxJQUFBLGNBQWMsRUFBQyxPQUFPLEVBQUU7UUFDOUMsNkJBQTZCLEVBQUUsSUFBSTtRQUVuQyxLQUFLLENBQUMsY0FBYyxDQUFFLEdBQVcsRUFBRSxLQUFhO1lBQzVDLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxLQUFLO2dCQUNkLE1BQU0sSUFBSSxzQkFBWSxDQUFDLHNCQUFjLENBQUMsNkJBQTZCLEVBQUUsVUFBVSxDQUFDLENBQUM7WUFFckYsT0FBTyxNQUFN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