[TASK] Initial commit: basic firebase setup and part 1 almost solved (of-by-one)
This commit is contained in:
19
functions/src/utils.ts
Normal file
19
functions/src/utils.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import {Request} from "firebase-functions/lib/common/providers/https";
|
||||
|
||||
class Utils {
|
||||
static parseInput(request: Request): string[] {
|
||||
|
||||
const body = request.body;
|
||||
if (typeof body === 'string') {
|
||||
return body.split('\n');
|
||||
} else if (body.constructor === Array) {
|
||||
return body;
|
||||
} else {
|
||||
throw Error("Invalid request");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default Utils;
|
||||
Reference in New Issue
Block a user