mirror of
https://github.com/cupcakearmy/cometa.git
synced 2025-09-06 04:50:40 +00:00
Dist
This commit is contained in:
26
dist/parser.js
vendored
Normal file
26
dist/parser.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const options_1 = require("./options");
|
||||
function computeParts(parts, data = {}) {
|
||||
if (parts.length === 0)
|
||||
return '';
|
||||
return computePart(parts[0], data) + computeParts(parts.slice(1), data);
|
||||
}
|
||||
exports.computeParts = computeParts;
|
||||
function computePart(part, data = {}) {
|
||||
if (options_1.isRender(part))
|
||||
return part;
|
||||
else
|
||||
return computePartFunction(part, data);
|
||||
}
|
||||
function computePartFunction(func, data = {}) {
|
||||
if (options_1.isRender(func))
|
||||
return func;
|
||||
else {
|
||||
const ret = func(data);
|
||||
if (options_1.isRender(ret))
|
||||
return ret;
|
||||
else
|
||||
return computeParts(ret, data);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user