Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = input => {
const match = input.match(/(Q|P)\d+/)
if (match) {
const id = match[0]
if (isEntityId(id)) return id
}
if (isNumericId(input)) return `Q${input}`
throw errors_.new('invalid id', input)
}