From 8cae97f4b8848799852d783da61863dcb2808682 Mon Sep 17 00:00:00 2001 From: Luke Blaney Date: Tue, 14 May 2024 00:24:23 +0100 Subject: [PATCH] Make dynamic name change compatible with legacy node versions Node 0.10 and 0.12 don't implement the `startsWith` function on strings --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index 08858b6..8566464 100644 --- a/mustache.js +++ b/mustache.js @@ -641,7 +641,7 @@ Writer.prototype.renderPartial = function renderPartial (token, context, partial var tags = this.getConfigTags(config); // Partial names beginning with an asterix are treated as a dynamic name - if (token[1].trim().startsWith('*')) { + if (token[1].trim().substring(0, 1) === '*') { token[1] = context.lookup(token[1].trim().substring(1).trim()); } var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];