Skip to content

Commit

Permalink
Slice By Value Set (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: david-vaclavek <david@localazy.com>
  • Loading branch information
david-vaclavek and david-vaclavek authored Apr 18, 2024
1 parent 23067cd commit 130ad15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/json-utils.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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 } });
}
Expand Down

0 comments on commit 130ad15

Please sign in to comment.