Skip to content

Commit

Permalink
make default options not exported
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Jul 26, 2020
1 parent 3963a4a commit ef70c2e
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions doT.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@
// 2011-2014, Laura Doktorova, https://github.com/olado/doT
// Licensed under the MIT license.

const doT = {
templateSettings: {
argName: "it",
encoders: {},
selfContained: false,
strip: true,
internalPrefix: "_val",
encodersPrefix: "_enc",
delimiters: {
start: "{{",
end: "}}",
},
},
module.exports = {
template,
compile,
setDelimiters,
}

module.exports = doT
const templateSettings = {
argName: "it",
encoders: {},
selfContained: false,
strip: true,
internalPrefix: "_val",
encodersPrefix: "_enc",
delimiters: {
start: "{{",
end: "}}",
},
}

// depends on selfContained mode
const encoderType = {
Expand Down Expand Up @@ -93,7 +92,7 @@ function unescape(code) {
function template(tmpl, c, def) {
const ds = c && c.delimiters
const syn = ds && !sameDelimiters(ds) ? getSyntax(ds) : currentSyntax
c = c ? {...doT.templateSettings, ...c} : doT.templateSettings
c = c ? {...templateSettings, ...c} : templateSettings
let sid = 0
let str = resolveDefs(c, syn, tmpl, def || {})
const needEncoders = {}
Expand Down Expand Up @@ -178,7 +177,7 @@ function compile(tmpl, def) {
}

function sameDelimiters({start, end}) {
const d = doT.templateSettings.delimiters
const d = templateSettings.delimiters
return d.start === start && d.end === end
}

Expand All @@ -188,7 +187,7 @@ function setDelimiters(delimiters) {
return
}
currentSyntax = getSyntax(delimiters)
doT.templateSettings.delimiters = delimiters
templateSettings.delimiters = delimiters
}

function getSyntax({start, end}) {
Expand Down

0 comments on commit ef70c2e

Please sign in to comment.