Source

validators/validateCaseInsensitiveKey.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Validate 'key' (e.g. status, type etc.) with case-insensitive RegExp test
 *
 * @param key The key to validate (to be constructed in RegExp)
 * @param value The value to test
 * @param isStrict If enabled, the regex will wrap the key with '^' and '$' symbol. Default to true.
 * @category validators
 * @module validateCaseInsensitiveKey
 */
function validateCaseInsensitiveKey(key, value, isStrict) {
    if (isStrict === void 0) { isStrict = true; }
    var regexStr = isStrict ? "^".concat(key, "$") : "".concat(key);
    return new RegExp(regexStr, 'i').test(value);
}
exports.default = validateCaseInsensitiveKey;