From 49acd65520e731e79986bbf24eb55cfb6bcdd9fe Mon Sep 17 00:00:00 2001 From: Tommaso Allevi Date: Fri, 29 Jan 2016 10:46:29 +0100 Subject: [PATCH] Use test instead of match For spead reason --- ExportAdapter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ExportAdapter.js b/ExportAdapter.js index 3ecddf4b4b..89cb6c5900 100644 --- a/ExportAdapter.js +++ b/ExportAdapter.js @@ -44,14 +44,16 @@ ExportAdapter.prototype.connect = function() { // Returns a promise for a Mongo collection. // Generally just for internal use. +var joinRegex = /^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/; +var otherRegex = /^[A-Za-z][A-Za-z0-9_]*$/; ExportAdapter.prototype.collection = function(className) { if (className !== '_User' && className !== '_Installation' && className !== '_Session' && className !== '_SCHEMA' && className !== '_Role' && - !className.match(/^_Join:[A-Za-z0-9_]+:[A-Za-z0-9_]+/) && - !className.match(/^[A-Za-z][A-Za-z0-9_]*$/)) { + !joinRegex.test(className) && + !otherRegex.test(className)) { throw new Parse.Error(Parse.Error.INVALID_CLASS_NAME, 'invalid className: ' + className); }