Skip to content

Commit

Permalink
chore: code tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Sep 19, 2024
1 parent 8e4b098 commit 7ca238b
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions packages/shared/src/utils/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,18 +578,3 @@ export const cleanupEmptyFolders = (folder: string) => {
fs.rmdirSync(folder);
}
};

/** Order a nested json-like object in alphabetical key order */
export const sortJsonKeys = <T extends Record<string, any>>(json: T): T => {
// return non json-type data as-is
if (!json || {}.constructor !== json.constructor) {
return json;
}
// recursively sort any nested json by key
return Object.keys(json)
.sort()
.reduce((obj, key) => {
obj[key] = sortJsonKeys(json[key]);
return obj;
}, {}) as T;
};

0 comments on commit 7ca238b

Please sign in to comment.