Skip to content

Commit 905dfdf

Browse files
alxndrsnjanl
authored andcommitted
isValidRev: cache regex
1 parent 84b7afb commit 905dfdf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/node_modules/pouchdb-core/src/adapter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ function isNotSingleDoc(doc) {
194194
return doc === null || typeof doc !== 'object' || Array.isArray(doc);
195195
}
196196

197+
const validRevRegex = /^\d+-[^-]*$/;
197198
function isValidRev(rev) {
198-
return typeof rev === 'string' && /^\d+-[^-]*$/.test(rev);
199+
return typeof rev === 'string' && validRevRegex.test(rev);
199200
}
200201

201202
class AbstractPouchDB extends EventEmitter {

0 commit comments

Comments
 (0)