MCPcopy Index your code
hub / github.com/pyscript/pyscript / assign

Function assign

core/src/stdlib/pyscript/ffi.py:148–164  ·  view source on GitHub ↗

Merge JavaScript objects (like [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)). Takes a target object and merges properties from one or more source objects into it, returning the modified target. ```python ob

(source, *args)

Source from the content-addressed store, hash-verified

146
147
148def assign(source, *args):
149 """
150 Merge JavaScript objects (like
151 [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)).
152
153 Takes a target object and merges properties from one or more source
154 objects into it, returning the modified target.
155
156 ```python
157 obj = js.Object.new()
158 ffi.assign(obj, {"a": 1}, {"b": 2})
159 # obj now has properties a=1 and b=2
160 ```
161 """
162 for arg in args:
163 _assign(source, to_js(arg))
164 return source

Callers 7

elFunction · 0.85
core.jsFile · 0.85
onWorkerFunction · 0.85
constructorMethod · 0.85
_createAlertBannerFunction · 0.85
donkeyFunction · 0.85

Calls 1

to_jsFunction · 0.85

Tested by

no test coverage detected