Skip to content

Commit

Permalink
WIP script
Browse files Browse the repository at this point in the history
  • Loading branch information
gipo355 committed May 28, 2024
1 parent 1d70663 commit d84ce6b
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions scripts/find-dep-dupes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,12 @@ import { readFileSync } from 'fs';
const args = process.argv.slice(2);

const findDupeKeys = (path: string) => {
// read the json file
const data = readFileSync(path, 'utf8');

// parse the json files
const obj = JSON.parse(data);

// create a map, key is the object key, value is the count
const map = new Map<string, number>();

// must traverse the object recursively
// it will check if there are dupicate keys in the json object recursively
// const traverse = (o: any) => {
// for (const key in o) {
// console.log(key, o[key]);
//
// if (typeof o[key] === 'object') {
// traverse(o[key]);
// } else {
// if (map.has(o[key])) {
// const current = map.get(o[key]);
// if (current !== undefined) {
// map.set(o[key], current + 1);
// }
// } else {
// map.set(o[key], 1);
// }
// }
// }
// };
const traverse = (o: any) => {
for (const key in o) {
if (typeof o[key] === 'object') {
Expand Down

0 comments on commit d84ce6b

Please sign in to comment.