Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in debug mode #236

Closed
erfanium opened this issue May 22, 2021 · 1 comment · Fixed by #237
Closed

bug in debug mode #236

erfanium opened this issue May 22, 2021 · 1 comment · Fixed by #237
Labels

Comments

@erfanium
Copy link
Collaborator

const v = new V({ debug:true })
const schema = { x: "string" }
const check = v.compile(schema)

output:

SyntaxError: Unexpected token (2:10)
  1 | // Context.fn[0]
> 2 | function () { [native code] }

output without prettier:

// Context.fn[0]
function () { [native code] }
// Context.fn[1]
function () { [native code] }

...

Because Function.prototype.bind is native code.
Related #231

@erfanium erfanium added the bug label May 22, 2021
@erfanium
Copy link
Collaborator Author

Possible solutions:

  1. Using Function.prototype.call instead of bind
  2. Store function source code as string in context for debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant