test-openapi
Version:
Automated client requests
29 lines (19 loc) • 488 B
JavaScript
const { isObject } = require('../../../../../utils')
// Check input arguments
const checkArgument = function(value, type) {
const isValid = TYPES[type](value)
if (isValid) {
return
}
throw new Error(`tap function argument must be ${type} not ${value}`)
}
const TYPES = {
string: value => typeof value === 'string',
integer: Number.isInteger,
boolean: value => typeof value === 'boolean',
object: isObject,
}
module.exports = {
checkArgument,
}