Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function invalidIdError(id) {
var err;
if (!id) {
err = pouchdbErrors.createError(pouchdbErrors.MISSING_ID);
} else if (typeof id !== 'string') {
err = pouchdbErrors.createError(pouchdbErrors.INVALID_ID);
} else if (/^_/.test(id) && !(/^_(design|local)/).test(id)) {
err = pouchdbErrors.createError(pouchdbErrors.RESERVED_ID);
}
if (err) {
throw err;
}
}