shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
set
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object
Set an object value using a dotted object path like “myObject.myProperty.myValue” to set his position
If the path parameter is set to ’.’, it will act like an Object.assign(obj, value).
Params
- obj*-Object
The object in which to set the value
- path*-String|String[]
The object path where to set the value
- value*-Mixed
The value to set
Return
- -Mixed
Return the setted value if setted correctly, or undefined if something goes wrong…
Example
import { set } from '@blackbyte/sugar/object';
set('myObject.cool.value', 'Hello world'); // => Hello worldSettings
- preferAssignfalseBoolean
Specify if you prefer using Object.assign rather than = for objects to keep references
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space