From 6e5d674dda301dec4cadfff978a3c80e92421087 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 15 Dec 2020 15:44:51 +0000 Subject: [PATCH] lint: attribute pool --- src/static/js/AttributePool.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/static/js/AttributePool.js b/src/static/js/AttributePool.js index 78d3e7c5b..1c30a7489 100644 --- a/src/static/js/AttributePool.js +++ b/src/static/js/AttributePool.js @@ -1,3 +1,5 @@ +'use strict'; + /** * This code represents the Attribute Pool Object of the original Etherpad. * 90% of the code is still like in the original Etherpad @@ -70,8 +72,10 @@ AttributePool.prototype.getAttribValue = function (num) { AttributePool.prototype.eachAttrib = function (func) { for (const n in this.numToAttrib) { - const pair = this.numToAttrib[n]; - func(pair[0], pair[1]); + if (this.numToAttrib[n]) { + const pair = this.numToAttrib[n]; + func(pair[0], pair[1]); + } } }; @@ -87,7 +91,9 @@ AttributePool.prototype.fromJsonable = function (obj) { this.nextNum = obj.nextNum; this.attribToNum = {}; for (const n in this.numToAttrib) { - this.attribToNum[String(this.numToAttrib[n])] = Number(n); + if (this.numToAttrib[n]) { + this.attribToNum[String(this.numToAttrib[n])] = Number(n); + } } return this; };