Skip to content

Commit

Permalink
Move route deduplication function
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak committed Mar 2, 2024
1 parent 3f48e4b commit d9f0902
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/cloudflare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export type Route = {

const delay = (n: number) => new Promise((res) => setTimeout(res, n));

const unique = (xs: any[], property = 'id'): any[] => {
return Object.values(
xs.reduce((acc, obj) => ({ ...acc, [obj[property]]: obj }))
);
};

async function retry(
fn: () => Promise<any>,
times = CLOUDFLARE_RETRIES,
Expand Down
6 changes: 0 additions & 6 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ const attrDifference = (x: any[], y: any[], property: string) => {
return x.filter((j) => !y.some((k) => j[property] == k[property]));
};

const unique = (xs: any[], property = 'id'): any[] => {
return Object.values(
xs.reduce((acc, obj) => ({ ...acc, [obj[property]]: obj }))
);
};

async function wrangler(config: (any) => any, fn: () => void) {
const configSaved = fs.readFileSync(`${CWD}/wrangler.toml`).toString();
const configObject = parseTOML(configSaved);
Expand Down

0 comments on commit d9f0902

Please sign in to comment.