mafintosh / mafintosh/pejs

Error thrown when closing blocks in diffrent ways

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
37
Forks
6
PR merge metrics
No merged PRs in 30d

Description

/node_modules/pejs/codegen.js:38
        tree.forEach(function(node) {
             ^
TypeError: Cannot call method 'forEach' of undefined
    at stringify (/node_modules/pejs/codegen.js:38:8)
    at /node_modules/pejs/codegen.js:59:54
    at Array.forEach (native)
    at stringify (/node_modules/pejs/codegen.js:38:8)
    at /node_modules/pejs/codegen.js:59:54
    at Array.forEach (native)
    at stringify (/node_modules/pejs/codegen.js:38:8)
    at codegen (node_modules/pejs/codegen.js:67:12)
    at /node_modules/pejs/index.js:93:48
    at /node_modules/pejs/sequence.js:11:12

The above error is thrown when trying to render the following template.

<%{ header %>
<% }%>

<%{ body %>
<%} %>

It somehow related to how the blocks are closed. The below template, for example, doesn't throw (notice how the blocks are closed).

<%{ header %>
<%} %>

<%{ body %>
<% }%>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the error with the two template examples and start at node_modules/pejs/codegen.js:38, following the calls through index.js and sequence.js. Compare the two block-closing forms and verify that both templates render without the TypeError while the already-working form continues to render.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.