It does not evaluate functions

Open
#41 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
tooling

Research direction

Reproduce the examples using esprima's parse and static-eval's staticEval, starting with the arrow-function call and then the array map expression. Trace how function expressions are handled and define completion as both shown expressions evaluating to their expected values, or document a confirmed workaround.

Written by the indexing model from the issue text.

Description

const { parse } = require('esprima');
const staticEval = require('static-eval');
const ast = parse('(() => 1)()');
const val = staticEval(ast.body[0].expression, {}, { allowAccessToMethodsOnFunctions: true });
// val is undefined

The expression I was actually trying to evaluate looks more like '[1,2,3].map(x => x)'

Is there some workaround?

Dominant language
JavaScript
Stars
177
Forks
27
PR merge metrics
No merged PRs in 30d

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.

More from browserify/static-eval

All issues in browserify/static-eval

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.