Usage:
set(obj, 'a.b.c.d.e', value)
||set(obj, [a, 'b', '@#$', 'd', 'e'], [1, 2, 3])
||set(arr, '0.1.2', true)
- For bracket notation (e.g. obj['@#$']), use arrays
- Creates arrays with numbered keys (numbers not allowed as objects keys, see other revisions for that)
Explanation
function set (
obj, // object in which to set nested properties