DelSkayn / rquickjs

High level bindings to the quickjs javascript engine
MIT License
431 stars 58 forks source link

Add Null support for function #317

Open Sytten opened 1 month ago

Sytten commented 1 month ago

Missing Null implementations

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.51%. Comparing base (304db5d) to head (826facc).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #317 +/- ## ========================================== + Coverage 68.31% 68.51% +0.19% ========================================== Files 83 83 Lines 12237 12300 +63 ========================================== + Hits 8360 8427 +67 + Misses 3877 3873 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Sytten commented 1 month ago

The conflict with the Null struct is kinda of annoying, we would also need a Nullable struct that has a IntoJs since Option returns undefined.

DelSkayn commented 3 weeks ago

I think this type should be called Nullable not Null since that already conflicts with the null value struct. Nullable also makes more sense I think cause the type is a wrapper around a value which might be null.

Also instead of implementing FromParams and IntoArgs maybe it should instead just implement IntoJs and FromJs. Then they can be used in function params and everywhere else you would need the absence of a value to be null.

Sytten commented 3 weeks ago

Good point, I wasn't sure what we wanted to do with that since we have Opt that is FromParams only and we already have the Null struct so you can do Either<Value, Null> already. Do you want me to remove function::Null since it's already in the codebase (I didn't create that struct, it must be from an earlier iteration)?