diff --git a/src/js/form-model.js b/src/js/form-model.js index a2252c1f..e216e5a5 100644 --- a/src/js/form-model.js +++ b/src/js/form-model.js @@ -50,7 +50,7 @@ const FormModel = function (data, options) { options.full = typeof options.full !== 'undefined' ? options.full : true; this.events = document.createElement('div'); - this.convertedExpressions = {}; + this.convertedExpressions = new Map(); this.templates = {}; this.loadErrors = []; @@ -1424,7 +1424,9 @@ FormModel.prototype.evaluate = function ( cacheable = original === expr; // if no cached conversion exists - if (!this.convertedExpressions[cacheKey]) { + const cachedExpr = this.convertedExpressions.get(cacheKey); + + if (cachedExpr === undefined) { expr = expr.trim(); expr = this.replaceInstanceFn(expr); expr = this.replaceVersionFn(expr); @@ -1439,11 +1441,12 @@ FormModel.prototype.evaluate = function ( expr = expr.replace(/</g, '<'); expr = expr.replace(/>/g, '>'); expr = expr.replace(/"/g, '"'); + if (cacheable) { - this.convertedExpressions[cacheKey] = expr; + this.convertedExpressions.set(cacheKey, expr); } } else { - expr = this.convertedExpressions[cacheKey]; + expr = cachedExpr; } resultTypes = {