robertkrimen / otto

A JavaScript interpreter in Go (golang)
http://godoc.org/github.com/robertkrimen/otto
MIT License
8.01k stars 584 forks source link

Implementation of the export and import keywords to support, amongst others, unit tests. #497

Open keithrooney opened 1 year ago

keithrooney commented 1 year ago

Hey there,

Is there plans to implement the export and import keywords? Reviewing the code base, I don't believe it is currently implemented, token.go#L44.

I am using Otto, implementing various functions to automate particular tasks, however, I'd like to add unit tests for these functions.

Correct me if I'm wrong, but in order to accomplish my goal of adding unit tests for these functions, one requires these specific keywords to export the functions then import said functions to the appropriate test files.

Open to thoughts and/or suggestions.

All the best,

Keith.

Asday commented 1 year ago
  • Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported.

-- https://github.com/robertkrimen/otto#caveat-emptor

Though this is slowly changing.

Try a pull request.

stevenh commented 1 year ago

What @Asday happy to review PR's which extend our existing functionality.

keithrooney commented 1 year ago

Absolutely @stevenh and @Asday ! Give me a few days to complete discovery on this item, understand the code base, implementation details, etc, after which I'll probably have a few questions. Once answered, I should be good to go. Feel free to assign this ticket to me (provided you've the ability to do so).