flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

View file

@ -0,0 +1,19 @@
const getVariableName = require('./getVariableName');
module.exports = function createPatternBuilder(dimension) {
return pattern;
function pattern(template, config) {
let indent = (config && config.indent) || 0;
let join = (config && config.join !== undefined) ? config.join : '\n';
let indentString = Array(indent + 1).join(' ');
let buffer = [];
for (let i = 0; i < dimension; ++i) {
let variableName = getVariableName(i);
let prefix = (i === 0) ? '' : indentString;
buffer.push(prefix + template.replace(/{var}/g, variableName));
}
return buffer.join(join);
}
};