Skip to content
Snippets Groups Projects
Verified Commit 541838b0 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Fix lint issues

parent 76ac3298
No related branches found
No related tags found
No related merge requests found
Pipeline #7316 passed
......@@ -25,7 +25,7 @@ class MatrixBackend extends BaseBackend {
set userId(value) {
if (value !== undefined) {
const matrixId = utils.splitMatrixId(value);
const homeServerUrl = 'https://' + matrixId.homeServer
const homeServerUrl = 'https://' + matrixId.homeServer;
this.api = sdk.createClient(homeServerUrl);
this.userId = value;
......
......@@ -17,6 +17,7 @@
* Split a Matrix ID into local part and homeserver
*
* @param {string} matrixId
* @return {Object}
*
* @example
* splitMatrixId('@foo:example.com')
......@@ -24,11 +25,11 @@
*/
export function splitMatrixId(matrixId) {
if (typeof matrixId !== 'string') {
throw 'Passed Matrix ID must be a string';
throw new Error('Passed Matrix ID must be a string');
} else if (matrixId.substr(0, 1) !== '@') {
throw 'Passed Matrix ID must begin with @';
throw new Error('Passed Matrix ID must begin with @');
} else if (matrixId.indexOf(':') < 2) {
throw 'Passed Matrix ID must contain : to separate local part and home server';
throw new Error('Passed Matrix ID must contain :');
}
const localPart = matrixId.substr(1).substr(0, matrixId.indexOf(':'));
......@@ -36,6 +37,6 @@ export function splitMatrixId(matrixId) {
return {
'localPart': localPart,
'homeServer': homeServer
}
'homeServer': homeServer,
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment