Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/cli-kit/src/public/node/toml/toml-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,11 @@ export class TomlFile {
* @returns Flattened patch entries.
*/
function flattenToPatchEntries(obj: {[key: string]: unknown}, prefix: string[] = []): [string[], TomlPatchValue][] {
const entries: [string[], TomlPatchValue][] = []
for (const [key, value] of Object.entries(obj)) {
return Object.entries(obj).flatMap(([key, value]) => {
const path = [...prefix, key]
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
entries.push(...flattenToPatchEntries(value as {[key: string]: unknown}, path))
} else {
entries.push([path, value as TomlPatchValue])
return flattenToPatchEntries(value as {[key: string]: unknown}, path)
}
}
return entries
return [[path, value as TomlPatchValue]]
})
}
Loading