UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

20 lines 839 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAnAllowedValue = void 0; const dictionary_1 = require("../errors/dictionary"); const utils_1 = require("../utils"); function isAnAllowedValue(allowValues) { return (param) => { param = (0, utils_1.removeQuotes)(param); const valid = allowValues.includes(param); if (!valid) { const msgError = dictionary_1.ERROR_DICTIONARY[dictionary_1.ERROR_LIST.invalidAllowValue]; return Object.assign(Object.assign({ valid }, msgError), { message: `${msgError.message} "${allowValues.join('", "')}"`, info: { allowedValues: allowValues, } }); } return { valid }; }; } exports.isAnAllowedValue = isAnAllowedValue; //# sourceMappingURL=isAnAllowedValue.js.map