Skip to content

Commit

Permalink
Make mustache.mjs work with Deno
Browse files Browse the repository at this point in the history
Minor adjustments needed to make the TypeScript compiler
that is built into Deno, be happy with how mustache.js'
ES module source looks in terms of function parameters
passed and object mutability.

Refs #1
  • Loading branch information
zekth authored and phillipj committed Nov 6, 2019
1 parent bc9bf03 commit 97cd2e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Mustache = factory());
}(this, function () { 'use strict';
}(this, (function () { 'use strict';

var version = "3.1.0";

Expand Down Expand Up @@ -529,7 +529,7 @@
*/
Writer.prototype.render = function render (template, view, partials, tags) {
var tokens = this.parse(template, tags);
var context = (view instanceof Context) ? view : new Context(view);
var context = (view instanceof Context) ? view : new Context(view, undefined);
return this.renderTokens(tokens, context, partials, template, tags);
};

Expand Down Expand Up @@ -654,7 +654,15 @@
var mustache = {
name: 'mustache.js',
version: version,
tags: [ '{{', '}}' ]
tags: [ '{{', '}}' ],
clearCache: undefined,
escape: undefined,
parse: undefined,
render: undefined,
to_html: undefined,
Scanner: undefined,
Context: undefined,
Writer: undefined
};

// All high-level mustache.* functions use this writer.
Expand Down Expand Up @@ -717,4 +725,4 @@

return mustache;

}));
})));
Loading

0 comments on commit 97cd2e1

Please # to comment.