Skip to content

Commit

Permalink
Merge pull request #73 from jordanshatford/feat/use-builtin-flatmap
Browse files Browse the repository at this point in the history
feat: use built in flat map
  • Loading branch information
mrlubos authored Mar 18, 2024
2 parents dc6b914 + 29dbb46 commit edb2d23
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
9 changes: 0 additions & 9 deletions src/utils/flatMap.spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/utils/flatMap.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/utils/postProcessServiceOperations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Operation } from '../client/interfaces/Operation';
import type { Service } from '../client/interfaces/Service';
import { flatMap } from './flatMap';

export const postProcessServiceOperations = (service: Service): Operation[] => {
const names = new Map<string, number>();
Expand All @@ -10,8 +9,8 @@ export const postProcessServiceOperations = (service: Service): Operation[] => {

// Parse the service parameters and results, very similar to how we parse
// properties of models. These methods will extend the type if needed.
clone.imports.push(...flatMap(clone.parameters, parameter => parameter.imports));
clone.imports.push(...flatMap(clone.results, result => result.imports));
clone.imports.push(...clone.parameters.flatMap(parameter => parameter.imports));
clone.imports.push(...clone.results.flatMap(result => result.imports));

// Check if the operation name is unique, if not then prefix this with a number
const name = clone.name;
Expand Down

0 comments on commit edb2d23

Please sign in to comment.