lint: src/node/db/ReadOnlyManager.js

This commit is contained in:
John McLear 2021-01-21 21:06:52 +00:00 committed by Richard Hansen
parent e06b9442e0
commit 5ce255c789

View file

@ -1,3 +1,4 @@
'use strict';
/**
* The ReadOnlyManager manages the database and rendering releated to read only pads
*/
@ -27,15 +28,13 @@ const randomString = require('../utils/randomstring');
* checks if the id pattern matches a read-only pad id
* @param {String} the pad's id
*/
exports.isReadOnlyId = function (id) {
return id.indexOf('r.') === 0;
};
exports.isReadOnlyId = (id) => id.indexOf('r.') === 0;
/**
* returns a read only id for a pad
* @param {String} padId the id of the pad
*/
exports.getReadOnlyId = async function (padId) {
exports.getReadOnlyId = async (padId) => {
// check if there is a pad2readonly entry
let readOnlyId = await db.get(`pad2readonly:${padId}`);
@ -53,15 +52,13 @@ exports.getReadOnlyId = async function (padId) {
* returns the padId for a read only id
* @param {String} readOnlyId read only id
*/
exports.getPadId = function (readOnlyId) {
return db.get(`readonly2pad:${readOnlyId}`);
};
exports.getPadId = (readOnlyId) => db.get(`readonly2pad:${readOnlyId}`);
/**
* returns the padId and readonlyPadId in an object for any id
* @param {String} padIdOrReadonlyPadId read only id or real pad id
*/
exports.getIds = async function (id) {
exports.getIds = async (id) => {
const readonly = (id.indexOf('r.') === 0);
// Might be null, if this is an unknown read-only id