Git Product home page Git Product logo

stack-generator's People

Contributors

bengourley avatar dependabot[bot] avatar eriwen avatar niftylettuce avatar oliversalzburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stack-generator's Issues

Function name regex can get incorrect name for annoymous function

Given the function source:

function () {
  // set the script that called this function
  updateLastScript(script)
  // immediately unset it
  _setTimeout(function () { updateLastScript(null) }, 0)
  cb.apply(this, arguments)
}

this Regex will incorrectly name the function updateLastScript which is an unfortunate sequence of a comment ending in function followed by a function call.

if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) {

a nested function definition can also trip it up:

function () {
  function jim() {
    // inner
  }
  more()
  statements()
}

The following update fixes these scenarios, correctly returning null for these two annonymous functions:

- if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) { 
+ if (/^\s*function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) { 

I'm not sure if the "any preceding whitespace" part is strictly necessary but I don't think it hurts to permit that.

I can put together a PR for this including tests but I wanted to post it up as an issue before I get around to that while I work around it.

"works everywhere except strict-mode"

Can you please clarify this statement?

If this pertains to the "use strict" JavaScript directive, what does that entail? Does it work on pages where some of the scripts you're tracing through use strict mode, or does this limitation apply to the calling script only?

Thanks ๐Ÿ™‚

RFC: Capture arguments when generating stack

Two possible approaches:

  • Stringify all arguments with Object.prototype.toString.call(arg)
  • Leave arguments alone and use them as is

Perhaps an option could be introduced that takes one approach or the other.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.