Skip to content

Commit 49acd65

Browse files
committed
Use test instead of match
For spead reason
1 parent a9aed0c commit 49acd65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ExportAdapter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ ExportAdapter.prototype.connect = function() {
4444

4545
// Returns a promise for a Mongo collection.
4646
// Generally just for internal use.
47+
var joinRegex = /^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/;
48+
var otherRegex = /^[A-Za-z][A-Za-z0-9_]*$/;
4749
ExportAdapter.prototype.collection = function(className) {
4850
if (className !== '_User' &&
4951
className !== '_Installation' &&
5052
className !== '_Session' &&
5153
className !== '_SCHEMA' &&
5254
className !== '_Role' &&
53-
!className.match(/^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/) &&
54-
!className.match(/^[A-Za-z][A-Za-z0-9_]*$/)) {
55+
!joinRegex.test(className) &&
56+
!otherRegex.test(className)) {
5557
throw new Parse.Error(Parse.Error.INVALID_CLASS_NAME,
5658
'invalid className: ' + className);
5759
}

0 commit comments

Comments
 (0)