Commit 356bbf30 authored by Stefan Cameron's avatar Stefan Cameron

Adding JSON type

This is the last of all the types!

Coverage: 100%
parent 28292b56
......@@ -1395,13 +1395,13 @@ var defs = {
/**
* JSON rules per qualifiers: Must be a JSON value:
*
* - {@link rtvref.types.NULL null}
* - {@link rtvref.types.STRING string}, however __empty strings are permitted__,
* even if the qualifier is `REQUIRED`;
* - {@link rtvref.types.BOOLEAN boolean};
* - {@link rtvref.types.FINITE finite number};
* - {@link rtvref.types.PLAIN_OBJECT plain object};
* - {@link rtvref.types.ARRAY array};
* - `null`
* even if the qualifier is `REQUIRED`
* - {@link rtvref.types.BOOLEAN boolean}
* - {@link rtvref.types.FINITE finite number}
* - {@link rtvref.types.PLAIN_OBJECT plain object}
* - {@link rtvref.types.ARRAY array}
*
* Since this type checks for _any_ valid JSON value, empty string and `null`
* values are permitted, even when the typeset is qualified as `REQUIRED`.
......@@ -5059,10 +5059,10 @@ function valClassObject(v) {
// only consider enumerable, own-properties of the shape
forEach_1(shape, function (typeset, prop) {
var result = impl$5.check(v[prop], typeset); // check prop value against shape prop typeset
var propResult = impl$5.check(v[prop], typeset); // check prop value against shape prop typeset
if (!result.valid) {
err = new RtvError(v, impl$5.toTypeset(type$21, q, args), [prop].concat(result.path), result.cause);
if (!propResult.valid) {
err = new RtvError(v, impl$5.toTypeset(type$21, q, args), [prop].concat(propResult.path), propResult.cause);
}
return !err; // break on first error
......@@ -5714,7 +5714,45 @@ var valInt$1 = Object.freeze({
default: valInt
});
////// valMap validator
////// isNull validation
/**
* Type: {@link rtvref.types.NULL NULL}
* @const {string} rtvref.validation.isFunction.type
*/
var type$24 = types.NULL;
/**
* {@link rtvref.validation.method Validation} for the
* {@link rtvref.types.NULL NULL} type.
* @function rtvref.validation.isNull.default
* @param {*} v Value to validate.
* @returns {boolean} `true` if validated; `false` otherwise.
*/
function isNull(v) {
return v === null;
}
////// isJson validation
/**
* Type: {@link rtvref.types.JSON JSON}
* @const {string} rtvref.validation.isJson.type
*/
var type$25 = types.JSON;
/**
* {@link rtvref.validation.method Validation} for the
* {@link rtvref.types.JSON JSON} type.
* @function rtvref.validation.isJson.default
* @param {*} v Value to validate.
* @returns {boolean} `true` if validated; `false` otherwise.
*/
function isJson(v) {
return isNull(v) || isString(v, { allowEmpty: true }) || isBoolean(v) || isFinite$1(v) || isPlainObject$1(v) || isArray$1(v);
}
////// valJson validator
var REQUIRED$12 = qualifiers.REQUIRED;
......@@ -5722,20 +5760,65 @@ var impl$12 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valMap.config
* @function rtvref.validator.valJson.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$11 = function config(settings) {
impl$12 = settings.impl;
};
/**
* {@link rtvref.validator.type_validator Validator} for the
* {@link rtvref.types.JSON JSON} type.
* @function rtvref.validator.valJson.default
* @param {*} v Value to validate.
* @param {string} [q] Validation qualifier. Defaults to
* {@link rtvref.qualifiers.REQUIRED REQUIRED}.
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valJson(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$12;
if (nilPermitted(v, q)) {
return new RtvSuccess();
}
if (isJson(v)) {
return new RtvSuccess();
}
return new RtvError(v, impl$12.toTypeset(type$25, q), [], impl$12.toTypeset(type$25, q, true));
}
var valJson$1 = Object.freeze({
get _impl () { return impl$12; },
type: type$25,
config: config$11,
default: valJson
});
////// valMap validator
var REQUIRED$13 = qualifiers.REQUIRED;
var impl$13 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valMap.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$12 = function config(settings) {
impl$13 = settings.impl;
};
//
// Determines if a typeset represents a string, and only a string.
// @param {rtvref.types.typeset} ts Typeset to check.
// @return {boolean} `true` if so; `false` otherwise.
//
var isStringTypeset = function isStringTypeset(ts) {
var fqts = impl$12.fullyQualify(ts);
var fqts = impl$13.fullyQualify(ts);
// must be `[qualifier, STRING]`, otherwise no
return fqts.length === 2 && fqts[1] === types.STRING;
......@@ -5752,7 +5835,7 @@ var isStringTypeset = function isStringTypeset(ts) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valMap(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$12;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$13;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -5798,29 +5881,29 @@ function valMap(v) {
value = _elem[1];
if (tsKeys) {
result = impl$12.check(key, tsKeys); // check KEY against typeset
result = impl$13.check(key, tsKeys); // check KEY against typeset
valid = result.valid;
if (!result.valid) {
// create a new error from the original, but with the KEY prepended to the path
result = new RtvError(v, impl$12.toTypeset(type$1, q, args), ['key=' + print(key)].concat(result.path), result.cause);
result = new RtvError(v, impl$13.toTypeset(type$1, q, args), ['key=' + print(key)].concat(result.path), result.cause);
}
if (valid && tsKeysIsString && reKeys) {
valid = reKeys.test(key); // check key against regex since it's a string
if (!valid) {
result = new RtvError(v, impl$12.toTypeset(type$1, q, args), ['key=' + print(key)], impl$12.toTypeset(type$1, q, args, true));
result = new RtvError(v, impl$13.toTypeset(type$1, q, args), ['key=' + print(key)], impl$13.toTypeset(type$1, q, args, true));
}
}
}
if (valid && tsValues) {
result = impl$12.check(value, tsValues); // check VALUE against typeset
result = impl$13.check(value, tsValues); // check VALUE against typeset
valid = result.valid;
if (!result.valid) {
// create a new error from the original, but still with the KEY added to the path
result = new RtvError(v, impl$12.toTypeset(type$1, q, args), ['valueKey=' + print(key)].concat(result.path), result.cause);
result = new RtvError(v, impl$13.toTypeset(type$1, q, args), ['valueKey=' + print(key)].concat(result.path), result.cause);
}
}
......@@ -5851,7 +5934,7 @@ function valMap(v) {
if (valid) {
result = new RtvSuccess();
} else {
result = new RtvError(v, impl$12.toTypeset(type$1, q, args), [], impl$12.toTypeset(type$1, q, args, true));
result = new RtvError(v, impl$13.toTypeset(type$1, q, args), [], impl$13.toTypeset(type$1, q, args, true));
}
}
......@@ -5860,44 +5943,25 @@ function valMap(v) {
var valMap$1 = Object.freeze({
get _impl () { return impl$12; },
get _impl () { return impl$13; },
type: type$1,
config: config$11,
config: config$12,
default: valMap
});
////// isNull validation
/**
* Type: {@link rtvref.types.NULL NULL}
* @const {string} rtvref.validation.isFunction.type
*/
var type$24 = types.NULL;
/**
* {@link rtvref.validation.method Validation} for the
* {@link rtvref.types.NULL NULL} type.
* @function rtvref.validation.isNull.default
* @param {*} v Value to validate.
* @returns {boolean} `true` if validated; `false` otherwise.
*/
function isNull(v) {
return v === null;
}
////// valNull validator
var REQUIRED$13 = qualifiers.REQUIRED;
var REQUIRED$14 = qualifiers.REQUIRED;
var impl$13 = void 0; // @type {rtvref.impl}
var impl$14 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valNull.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$12 = function config(settings) {
impl$13 = settings.impl;
var config$13 = function config(settings) {
impl$14 = settings.impl;
};
/**
......@@ -5910,7 +5974,7 @@ var config$12 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valNull(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$13;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$14;
if (nilPermitted(v, q)) {
return new RtvSuccess();
......@@ -5920,13 +5984,13 @@ function valNull(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$13.toTypeset(type$24, q), [], impl$13.toTypeset(type$24, q, true));
return new RtvError(v, impl$14.toTypeset(type$24, q), [], impl$14.toTypeset(type$24, q, true));
}
var valNull$1 = Object.freeze({
get _impl () { return impl$13; },
get _impl () { return impl$14; },
type: type$24,
config: config$12,
config: config$13,
default: valNull
});
......@@ -6009,7 +6073,7 @@ var _isNaN = isNaN;
* Type: {@link rtvref.types.NUMBER NUMBER}
* @const {string} rtvref.validation.isNumber.type
*/
var type$25 = types.NUMBER;
var type$26 = types.NUMBER;
/**
* {@link rtvref.validation.method Validation} for the
......@@ -6030,17 +6094,17 @@ function isNumber$1(v) {
////// valNumber validator
var REQUIRED$14 = qualifiers.REQUIRED;
var REQUIRED$15 = qualifiers.REQUIRED;
var impl$14 = void 0; // @type {rtvref.impl}
var impl$15 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valNumber.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$13 = function config(settings) {
impl$14 = settings.impl;
var config$14 = function config(settings) {
impl$15 = settings.impl;
};
/**
......@@ -6059,7 +6123,7 @@ var config$13 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valNumber(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$14;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$15;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -6069,7 +6133,7 @@ function valNumber(v) {
var valid = isNumber$1(v);
// all qualifiers other than REQUIRED allow NaN
if (q !== REQUIRED$14 && _isNaN(v)) {
if (q !== REQUIRED$15 && _isNaN(v)) {
valid = true;
}
......@@ -6097,29 +6161,29 @@ function valNumber(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$14.toTypeset(type$25, q, args), [], impl$14.toTypeset(type$25, q, args, true));
return new RtvError(v, impl$15.toTypeset(type$26, q, args), [], impl$15.toTypeset(type$26, q, args, true));
}
var valNumber$1 = Object.freeze({
get _impl () { return impl$14; },
type: type$25,
config: config$13,
get _impl () { return impl$15; },
type: type$26,
config: config$14,
default: valNumber
});
////// valObject validator
var REQUIRED$15 = qualifiers.REQUIRED;
var REQUIRED$16 = qualifiers.REQUIRED;
var impl$15 = void 0; // @type {rtvref.impl}
var impl$16 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valObject.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$14 = function config(settings) {
impl$15 = settings.impl;
var config$15 = function config(settings) {
impl$16 = settings.impl;
};
/**
......@@ -6133,7 +6197,7 @@ var config$14 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valObject(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$15;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$16;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -6141,7 +6205,7 @@ function valObject(v) {
}
if (!isObject$1(v)) {
return new RtvError(v, impl$15.toTypeset(type$9, q), [], impl$15.toTypeset(type$9, q, true));
return new RtvError(v, impl$16.toTypeset(type$9, q), [], impl$16.toTypeset(type$9, q, true));
}
// args is the optional shape: ignore if it isn't a shape, like other validators
......@@ -6151,7 +6215,7 @@ function valObject(v) {
// only consider enumerable, own-properties of the shape
forEach_1(shape, function (typeset, prop) {
var result = impl$15.check(v[prop], typeset); // check prop value against shape prop typeset
var result = impl$16.check(v[prop], typeset); // check prop value against shape prop typeset
if (!result.valid) {
err = new RtvError(v, shape, [prop].concat(result.path), result.cause);
......@@ -6164,25 +6228,25 @@ function valObject(v) {
}
var valObject$1 = Object.freeze({
get _impl () { return impl$15; },
get _impl () { return impl$16; },
type: type$9,
config: config$14,
config: config$15,
default: valObject
});
////// valPlainObject validator
var REQUIRED$16 = qualifiers.REQUIRED;
var REQUIRED$17 = qualifiers.REQUIRED;
var impl$16 = void 0; // @type {rtvref.impl}
var impl$17 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valPlainObject.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$15 = function config(settings) {
impl$16 = settings.impl;
var config$16 = function config(settings) {
impl$17 = settings.impl;
};
/**
......@@ -6196,7 +6260,7 @@ var config$15 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valPlainObject(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$16;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$17;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -6204,7 +6268,7 @@ function valPlainObject(v) {
}
if (!isPlainObject$1(v)) {
return new RtvError(v, impl$16.toTypeset(type$20, q), [], impl$16.toTypeset(type$20, q, true));
return new RtvError(v, impl$17.toTypeset(type$20, q), [], impl$17.toTypeset(type$20, q, true));
}
// args is the optional shape: ignore if it isn't a shape, like other validators
......@@ -6214,7 +6278,7 @@ function valPlainObject(v) {
// only consider enumerable, own-properties of the shape
forEach_1(shape, function (typeset, prop) {
var result = impl$16.check(v[prop], typeset); // check prop value against shape prop typeset
var result = impl$17.check(v[prop], typeset); // check prop value against shape prop typeset
if (!result.valid) {
err = new RtvError(v, shape, [prop].concat(result.path), result.cause);
......@@ -6227,25 +6291,25 @@ function valPlainObject(v) {
}
var valPlainObject$1 = Object.freeze({
get _impl () { return impl$16; },
get _impl () { return impl$17; },
type: type$20,
config: config$15,
config: config$16,
default: valPlainObject
});
////// valPromise validator
var REQUIRED$17 = qualifiers.REQUIRED;
var REQUIRED$18 = qualifiers.REQUIRED;
var impl$17 = void 0; // @type {rtvref.impl}
var impl$18 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valPromise.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$16 = function config(settings) {
impl$17 = settings.impl;
var config$17 = function config(settings) {
impl$18 = settings.impl;
};
/**
......@@ -6258,7 +6322,7 @@ var config$16 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valPromise(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$17;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$18;
if (nilPermitted(v, q)) {
return new RtvSuccess();
......@@ -6268,29 +6332,29 @@ function valPromise(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$17.toTypeset(type$8, q), [], impl$17.toTypeset(type$8, q, true));
return new RtvError(v, impl$18.toTypeset(type$8, q), [], impl$18.toTypeset(type$8, q, true));
}
var valPromise$1 = Object.freeze({
get _impl () { return impl$17; },
get _impl () { return impl$18; },
type: type$8,
config: config$16,
config: config$17,
default: valPromise
});
////// valRegExp validator
var REQUIRED$18 = qualifiers.REQUIRED;
var REQUIRED$19 = qualifiers.REQUIRED;
var impl$18 = void 0; // @type {rtvref.impl}
var impl$19 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valRegExp.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$17 = function config(settings) {
impl$18 = settings.impl;
var config$18 = function config(settings) {
impl$19 = settings.impl;
};
/**
......@@ -6303,7 +6367,7 @@ var config$17 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valRegExp(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$18;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$19;
if (nilPermitted(v, q)) {
return new RtvSuccess();
......@@ -6313,13 +6377,13 @@ function valRegExp(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$18.toTypeset(type$5, q), [], impl$18.toTypeset(type$5, q, true));
return new RtvError(v, impl$19.toTypeset(type$5, q), [], impl$19.toTypeset(type$5, q, true));
}
var valRegExp$1 = Object.freeze({
get _impl () { return impl$18; },
get _impl () { return impl$19; },
type: type$5,
config: config$17,
config: config$18,
default: valRegExp
});
......@@ -6365,7 +6429,7 @@ var isSafeInteger_1 = isSafeInteger;
* Type: {@link rtvref.types.SAFE_INT SAFE_INT}
* @const {string} rtvref.validation.isSafeInt.type
*/
var type$26 = types.SAFE_INT;
var type$27 = types.SAFE_INT;
/**
* {@link rtvref.validation.method Validation} for the
......@@ -6385,17 +6449,17 @@ function isSafeInt(v) {
////// valSafeInt validator
var REQUIRED$19 = qualifiers.REQUIRED;
var REQUIRED$20 = qualifiers.REQUIRED;
var impl$19 = void 0; // @type {rtvref.impl}
var impl$20 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valSafeInt.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$18 = function config(settings) {
impl$19 = settings.impl;
var config$19 = function config(settings) {
impl$20 = settings.impl;
};
/**
......@@ -6414,7 +6478,7 @@ var config$18 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valSafeInt(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$19;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$20;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -6446,29 +6510,29 @@ function valSafeInt(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$19.toTypeset(type$26, q, args), [], impl$19.toTypeset(type$26, q, args, true));
return new RtvError(v, impl$20.toTypeset(type$27, q, args), [], impl$20.toTypeset(type$27, q, args, true));
}
var valSafeInt$1 = Object.freeze({
get _impl () { return impl$19; },
type: type$26,
config: config$18,
get _impl () { return impl$20; },
type: type$27,
config: config$19,
default: valSafeInt
});
////// valSet validator
var REQUIRED$20 = qualifiers.REQUIRED;
var REQUIRED$21 = qualifiers.REQUIRED;
var impl$20 = void 0; // @type {rtvref.impl}
var impl$21 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valSet.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$19 = function config(settings) {
impl$20 = settings.impl;
var config$20 = function config(settings) {
impl$21 = settings.impl;
};
/**
......@@ -6482,7 +6546,7 @@ var config$19 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valSet(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$20;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$21;
var args = arguments[2];
if (nilPermitted(v, q)) {
......@@ -6515,13 +6579,13 @@ function valSet(v) {
for (var _iterator = it[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var elem = _step.value;
result = impl$20.check(elem, tsValues); // check value against typeset
result = impl$21.check(elem, tsValues); // check value against typeset
valid = result.valid;
if (!result.valid) {
// create a new error from the original, but with the value prepended to
// the path (since sets don't have indexes; they just have unique values)
result = new RtvError(v, impl$20.toTypeset(type$3, q, args), [print(elem)].concat(result.path), result.cause);
result = new RtvError(v, impl$21.toTypeset(type$3, q, args), [print(elem)].concat(result.path), result.cause);
}
if (!valid) {
......@@ -6551,7 +6615,7 @@ function valSet(v) {
if (valid) {
result = new RtvSuccess();
} else {
result = new RtvError(v, impl$20.toTypeset(type$3, q, args), [], impl$20.toTypeset(type$3, q, args, true));
result = new RtvError(v, impl$21.toTypeset(type$3, q, args), [], impl$21.toTypeset(type$3, q, args, true));
}
}
......@@ -6559,25 +6623,25 @@ function valSet(v) {
}
var valSet$1 = Object.freeze({
get _impl () { return impl$20; },
get _impl () { return impl$21; },
type: type$3,
config: config$19,
config: config$20,
default: valSet
});
////// valString validator
var REQUIRED$21 = qualifiers.REQUIRED;
var REQUIRED$22 = qualifiers.REQUIRED;
var impl$21 = void 0; // @type {rtvref.impl}
var impl$22 = void 0; // @type {rtvref.impl}
/**
* {@link rtvref.validator.validator_config Configuration Function}
* @function rtvref.validator.valString.config
* @param {rtvref.validator.validator_config_settings} settings Configuration settings.
*/
var config$20 = function config(settings) {
impl$21 = settings.impl;
var config$21 = function config(settings) {
impl$22 = settings.impl;
};
/**
......@@ -6596,14 +6660,14 @@ var config$20 = function config(settings) {
* @returns {(rtvref.RtvSuccess|rtvref.RtvError)} An `RtvSuccess` if valid; `RtvError` if not.
*/
function valString(v) {
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$21;
var q = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : REQUIRED$22;
var args = arguments[2];
if (nilPermitted(v, q)) {
return new RtvSuccess();
}
var valid = isString(v) || q !== REQUIRED$21 && v === '';
var valid = isString(v) || q !== REQUIRED$22 && v === '';
if (valid && args) {
// then check args
......@@ -6633,13 +6697,13 @@ function valString(v) {
return new RtvSuccess();
}
return new RtvError(v, impl$21.toTypeset(type$10, q, args), [], impl$21.toTypeset(type$10, q, args, true));
return new RtvError(v, impl$22.toTypeset(type$10, q, args), [], impl$22.toTypeset(type$10, q, args, true));
}
var valString$1 = Object.freeze({
get _impl () { return impl$21; },
get _impl () { return impl$22; },
type: type$10,
config: config$20,