set empty-keyed DATA if null

This commit is contained in:
buzz-lightsnack-2007 2024-05-23 15:56:46 +08:00
parent 796a776563
commit d625972726

View file

@ -46,6 +46,7 @@ nested.dictionary = class dictionary {
*/
static set(data, path, value, options = {}) {
let DATA = data, PATH = path, VALUE = value;
(DATA == null) ? DATA = {} : false;
// Convert path into an array if not yet set.
PATH = (Array.isArray(PATH)) ? PATH : (PATH && (typeof PATH).includes(`str`)) ? PATH.trim().split(`,`) : [];