The job ID object to validate, containing value and optional constraints.
Optional
verbose: boolean = falseIf true, logs validation result to the console.
Checks a job ID against the constraints defined in the JobIdValidable object:
required
is true, ensures the value is not empty.minLength
is set, ensures the value meets the minimum length.maxLength
is set, ensures the value does not exceed the maximum length.pattern
is set, ensures the value matches the regular expression.
Trims the value before validation. Logs a message if verbose is true.const jobId = { value: 'ncbiblast-I20200317-103136-0485-5599422-np2', minLength: 35,
pattern: /([a-z_])*-([A-Z0-9])*-\d*-\d*-\d*-(np2|p1m|p2m)$/ };
console.log(validateJobId(jobId)); // Outputs: true
const invalidJobId = { value: 'invalid', required: true };
console.log(validateJobId(invalidJobId, true)); // Outputs: false (logs "JobId "invalid" is not valid!")
Validates a job ID object against specified constraints.