[addon] blacklist moch bad tokens and return a indication response

This commit is contained in:
TheBeastLT
2021-03-10 17:17:56 +01:00
parent 1c6447add6
commit 2cd111bec7
6 changed files with 75 additions and 25 deletions

View File

@@ -1,7 +1,9 @@
const BadTokenError = { code: 'BAD_TOKEN' }
function chunkArray(arr, size) {
return arr.length > size
? [arr.slice(0, size), ...chunkArray(arr.slice(size), size)]
: [arr];
}
module.exports = { chunkArray }
module.exports = { chunkArray, BadTokenError }