Fix regex usage error and increase efficiency
This commit is contained in:
@@ -5,7 +5,7 @@ const admin = require("firebase-admin");
|
|||||||
admin.initializeApp();
|
admin.initializeApp();
|
||||||
const db = admin.firestore();
|
const db = admin.firestore();
|
||||||
|
|
||||||
const LOCAL_TESTING = false;
|
const LOCAL_TESTING = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Randomises the items in an array.
|
* Randomises the items in an array.
|
||||||
@@ -360,6 +360,11 @@ function cleanseVocabString(item) {
|
|||||||
return newString;
|
return newString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.cleanseVocabString = functions.https.onCall((data, context) => {
|
||||||
|
const chars = /[ °"§%()\[\]{}=\\?´`'#<>|,;.:+_-]+/g;
|
||||||
|
return data.replace(chars, "");
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes a response to a question in a vocab set.
|
* Processes a response to a question in a vocab set.
|
||||||
* @param {object} data The data passed to the function.
|
* @param {object} data The data passed to the function.
|
||||||
|
|||||||
Reference in New Issue
Block a user