ubq-testing / issue-spec-rewrite

0 stars 0 forks source link

Create TypeScript Utility Package for Common Functions #1

Open Keyrxng opened 1 month ago

Keyrxng commented 1 month ago

We need to create an npm package that provides a set of utility functions written in TypeScript. These functions will be useful for common tasks across our projects. The package should be well-tested, documented, and maintainable.

  1. stringUtils.capitalize(str: string): string
    • Capitalizes the first letter of a given string.
  2. arrayUtils.shuffle<T>(arr: T[]): T[]
    • Shuffles the elements of an array randomly.
  3. dateUtils.formatDate(date: Date, format: string): string
    • Formats a date object according to the specified format (e.g., "YYYY-MM-DD").
  4. mathUtils.calculateDiscount(originalPrice: number, discountPercentage: number): number
    • Calculates the discounted price based on the original price and discount percentage.

Acceptance Criteria

  1. Scope Clarification:

    • Instead of a generic utility package, let's focus on a specific area. For example, we could create a package specifically for handling date-related functions (@my-awesome-utils/dates).
    • This narrower scope will allow us to provide more specialized and well-tested functions.
  2. Function Naming Convention:

    • I recommend using a consistent naming convention for our utility functions. We can follow the pattern of moduleName.functionName.
    • For instance:
      • dates.formatDate(date: Date, format: string): string
      • dates.calculateAge(birthDate: Date): number

It seems that the author of the issue agrees with this approach. However, there is a comment that says "/rewrite" which suggests that the issue may need to be rewritten. It is unclear what exactly needs to be rewritten, so further clarification may be needed.

No linked issues or pull requests were found in the conversation.

Based on the information provided, it is recommended to update the issue spec to include the scope clarification and function naming convention. If there is a need to rewrite the issue, it should be discussed further to determine the specific changes required.

keyrxng2 commented 1 month ago

I think it's best if we follow this approach with things

  1. Scope Clarification:

    • Instead of a generic utility package, let's focus on a specific area. For example, we could create a package specifically for handling date-related functions (@my-awesome-utils/dates).
    • This narrower scope will allow us to provide more specialized and well-tested functions.
  2. Function Naming Convention:

    • I recommend using a consistent naming convention for our utility functions. We can follow the pattern of moduleName.functionName.
    • For instance:
      • dates.formatDate(date: Date, format: string): string
      • dates.calculateAge(birthDate: Date): number
Keyrxng commented 1 month ago

I agree with this approach

Keyrxng commented 1 month ago

I think each module should have it's own issue that way we keep prs small

keyrxng2 commented 1 month ago

I'll work on the dates and math modules, @Keyrxng can you do the rest?

Keyrxng commented 1 month ago

Fine by me, let's get a task list going with who is assigned to what

Keyrxng commented 1 month ago

/rewrite

github-actions[bot] commented 1 month ago

Spec updated successfully

Keyrxng commented 1 month ago

/rewrite

github-actions[bot] commented 1 month ago

Spec updated successfully