Convert Python objects to JavaScript objects. This ensures a Python `dict` becomes a [proper JavaScript object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) rather a JavaScript [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScri
(value, **kw)
| 72 | |
| 73 | |
| 74 | def to_js(value, **kw): |
| 75 | """ |
| 76 | Convert Python objects to JavaScript objects. |
| 77 | |
| 78 | This ensures a Python `dict` becomes a |
| 79 | [proper JavaScript object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |
| 80 | rather a JavaScript [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), |
| 81 | which is more intuitive for most use cases. |
| 82 | |
| 83 | Where required, the underlying `to_js` uses `Object.fromEntries` for |
| 84 | `dict` conversion. |
| 85 | |
| 86 | ```python |
| 87 | from pyscript import ffi |
| 88 | import js |
| 89 | |
| 90 | |
| 91 | note = { |
| 92 | "body": "This is a notification", |
| 93 | "icon": "icon.png" |
| 94 | } |
| 95 | |
| 96 | js.Notification.new("Hello!", ffi.to_js(note)) |
| 97 | ``` |
| 98 | """ |
| 99 | return _to_js_wrapper(value, **kw) |
| 100 | |
| 101 | |
| 102 | def is_none(value): |