INNER CODE UNIT · JavaScript
setLoopVars
figranium/figranium · src/agent/figranite/index.js:333
const setLoopVars = (item, index, count) => {
runtimeVars['loop.index'] = index;
runtimeVars['loop.count'] = count;
runtimeVars['loop.item'] = item;
if (item && typeof item === 'object') {
if ('text' in item) runtimeVars['loop.text'] = item.text;
if ('html' in item) runtimeVars['loop.html'] = item.html;
} else {
runtimeVars['loop.text'] = item;
runtimeVars['loop.html'] = '';
}
};
const ensureCapturesDir = async () => {
const capturesDir = path.join(__dirname, '../../public', 'captures');
// ⚡ Bolt: Use non-blocking directory creation
await fs.promises.mkdir(capturesDir, { recursive: true });
return capturesDir;