From 130ad15877fd3594b8e254bc23bd08147daa6667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20V=C3=A1clavek?= <49518842+david-vaclavek@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:21:41 +0200 Subject: [PATCH] Slice By Value Set (#13) Co-authored-by: david-vaclavek --- src/utils/json-utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/json-utils.ts b/src/utils/json-utils.ts index ad9fb85..ec37e92 100644 --- a/src/utils/json-utils.ts +++ b/src/utils/json-utils.ts @@ -1,4 +1,4 @@ -import { chunk, isPlainObject, merge, set } from 'lodash-es'; +import { chunk, isPlainObject, merge, setWith } from 'lodash-es'; import { I18nJson } from '@/types/i18n-json'; import { Json } from '@/types/json'; @@ -43,7 +43,7 @@ export class JsonUtils { if (isPlainObject(value)) { prev.push(...JsonUtils.sliceByValue(value, [...keys, key])); } else if (keys.length > 1) { - prev.push(set({}, [...keys, key].join('.'), value)); + prev.push(setWith({}, [...keys, key].join('.'), value, Object)); } else { prev.push({ [keys[0]]: { [key]: value } }); }