mirror of
https://github.com/github/codeql-action
synced 2026-10-07 00:30:17 +03:00
Add boolean Validator to json module
This commit is contained in:
Generated
+6
-2
@@ -92812,10 +92812,10 @@ var require_util12 = __commonJS({
|
||||
return objectToString(arg) === "[object Array]";
|
||||
}
|
||||
exports2.isArray = isArray2;
|
||||
function isBoolean(arg) {
|
||||
function isBoolean2(arg) {
|
||||
return typeof arg === "boolean";
|
||||
}
|
||||
exports2.isBoolean = isBoolean;
|
||||
exports2.isBoolean = isBoolean2;
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
@@ -144592,6 +144592,9 @@ function isString(value) {
|
||||
function isNumber(value) {
|
||||
return typeof value === "number";
|
||||
}
|
||||
function isBoolean(value) {
|
||||
return typeof value === "boolean";
|
||||
}
|
||||
function isStringOrUndefined(value) {
|
||||
return value === void 0 || isString(value);
|
||||
}
|
||||
@@ -144607,6 +144610,7 @@ function makeValidator(validate) {
|
||||
}
|
||||
var string = makeValidator(isString);
|
||||
var number = makeValidator(isNumber);
|
||||
var boolean = makeValidator(isBoolean);
|
||||
function array(validator) {
|
||||
const validate = (val) => {
|
||||
return isArray(val) && val.every((e) => validator.validate(e));
|
||||
|
||||
@@ -35,6 +35,11 @@ export function isNumber(value: unknown): value is number {
|
||||
return typeof value === "number";
|
||||
}
|
||||
|
||||
/** Asserts that `value` is a boolean. */
|
||||
export function isBoolean(value: unknown): value is boolean {
|
||||
return typeof value === "boolean";
|
||||
}
|
||||
|
||||
/** Asserts that `value` is either a string or undefined. */
|
||||
export function isStringOrUndefined(
|
||||
value: unknown,
|
||||
@@ -79,6 +84,9 @@ export const string = makeValidator(isString);
|
||||
/** A validator for number fields in schemas. */
|
||||
export const number = makeValidator(isNumber);
|
||||
|
||||
/** A validator for boolean fields in schemas. */
|
||||
export const boolean = makeValidator(isBoolean);
|
||||
|
||||
/** A validator for arrays. */
|
||||
export function array<T>(validator: Validator<T>) {
|
||||
const validate = (val: unknown) => {
|
||||
|
||||
Reference in New Issue
Block a user