set empty-keyed DATA if null
This commit is contained in:
parent
796a776563
commit
d625972726
1 changed files with 1 additions and 0 deletions
|
@ -46,6 +46,7 @@ nested.dictionary = class dictionary {
|
||||||
*/
|
*/
|
||||||
static set(data, path, value, options = {}) {
|
static set(data, path, value, options = {}) {
|
||||||
let DATA = data, PATH = path, VALUE = value;
|
let DATA = data, PATH = path, VALUE = value;
|
||||||
|
(DATA == null) ? DATA = {} : false;
|
||||||
|
|
||||||
// Convert path into an array if not yet set.
|
// Convert path into an array if not yet set.
|
||||||
PATH = (Array.isArray(PATH)) ? PATH : (PATH && (typeof PATH).includes(`str`)) ? PATH.trim().split(`,`) : [];
|
PATH = (Array.isArray(PATH)) ? PATH : (PATH && (typeof PATH).includes(`str`)) ? PATH.trim().split(`,`) : [];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue