Skip to content

Commit

Permalink
Replace custom groupBy implementation with Object.groupBy and remove …
Browse files Browse the repository at this point in the history
…related tests (#498)
  • Loading branch information
mlhaufe authored Feb 23, 2025
1 parent 8967e64 commit f3fd52e
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 62 deletions.
2 changes: 1 addition & 1 deletion application/OrganizationInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export class OrganizationInteractor extends Interactor<req.Organization> {
})
// Group the results by the requirement type
return groupBy(requirements, ({ req_type }) => req_type)
return Object.groupBy(requirements, ({ req_type }) => req_type)
}
*/

Expand Down
4 changes: 2 additions & 2 deletions server/data/services/NaturalLanguageToRequirementService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { v7 as uuidv7 } from 'uuid';
import zodToJsonSchema from "zod-to-json-schema";
import zodSchema from '../llm-zod-schemas/index.js'
import { zodResponseFormat } from "openai/helpers/zod";
import { dedent, groupBy } from "#shared/utils";
import { dedent } from "#shared/utils";

type LLMResponseType = typeof zodSchema['_type']['requirements']
type ArrayToUnion<T> = T extends (infer U)[] ? U : never
Expand Down Expand Up @@ -53,6 +53,6 @@ export default class NaturalLanguageToRequirementService {
const result = (completion.choices[0].message.parsed?.requirements ?? [])
.map((req) => ({ ...req, id: uuidv7() }));

return groupBy(result, ({ type }) => type) as ParsedRequirementGroup
return Object.groupBy(result, ({ type }) => type) as ParsedRequirementGroup
}
}
46 changes: 0 additions & 46 deletions shared/utils/groupBy.test.ts

This file was deleted.

12 changes: 0 additions & 12 deletions shared/utils/groupBy.ts

This file was deleted.

1 change: 0 additions & 1 deletion shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './camelCaseToTitleCase';
export * from './debounce';
export * from './dedent';
export * from './deSlugify';
export * from './groupBy';
export * from './pascalCaseToSnakeCase'
export * from './slugify';
export * from './snakeCaseToCamelCase';
Expand Down

0 comments on commit f3fd52e

Please sign in to comment.