mirror of
https://github.com/danbulant/jose
synced 2026-05-19 20:38:42 +00:00
8 lines
299 B
JavaScript
8 lines
299 B
JavaScript
const isNotString = val => typeof val !== 'string' || val.length === 0
|
|
|
|
module.exports.isNotString = isNotString
|
|
module.exports.isStringOptional = function isStringOptional (Err, value, label) {
|
|
if (value !== undefined && isNotString(value)) {
|
|
throw new Err(`${label} must be a string`)
|
|
}
|
|
}
|